Our Sponsors



Custom jobs at low cost, free lancers and service buyers.
PHP Nuke themes, stock photos, icons, drupal themes and more.



Western Studios :: View topic - 4images usergroup hack - help please (SOLVED)
Need Jobs done? Use our brand new Jobs Board to get your projects done at affordable prices.
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups     ProfileProfile   Log inLog in 


4images usergroup hack - help please (SOLVED)


Goto page Previous  1, 2
 
Post new topic   Reply to topicprinter friendly version    Western Studios Forum Index -> 4 Images
Western Studios

X-perienced
X-perienced
~PHP Nuke User~

Platinum Subscriber

Posts: 110
Next Group: 40 posts
Anna wrote:

Finally have this one nailed down tight and working Very Happy

For anyone else who may like to use it (though this probably will not work on nuked versions), the solution is ...

This will automatically assign a user to a specified usergroup once they have uploaded a specified number of images to the gallery.

In member.php find:
Code:

  $sql = "INSERT INTO ".IMAGES_TEMP_TABLE."
                (cat_id, user_id, image_name, image_description, image_keywords, image_date, image_media_file, image_thumb_file, image_download_url".$additional_field_sql.")
                VALUES
                ($cat_id, ".$user_info['user_id'].", '$image_name', '$image_description', '$image_keywords', $current_time, '$new_name', '$new_thumb_name', '$image_download_url'".$additional_value_sql.")";
        $result = $site_db->query($sql);
      }
 

Add below:
Code:

//-------------------------------------------------------
//--- START assign user to group after upload x images --
//-------------------------------------------------------

if ($user_info['user_id'] != 0) {
   $userv_id=$user_info['user_id'];
$sql = "SELECT group_id
       FROM ".GROUP_MATCH_TABLE."
         WHERE  user_id = $userv_id";
       $result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
    if ($num_rows < 1){
  $sql = "SELECT COUNT(image_id) AS totimg
         FROM ".IMAGES_TABLE."
         WHERE  user_id = $userv_id";
    $result = $site_db->query($sql);
   $row = $site_db->fetch_array($result);
   $uploaded_images = $row['totimg'];
if ($uploaded_images > 4) {
 $sql = "INSERT INTO ".GROUP_MATCH_TABLE."
                (group_id, user_id, groupmatch_startdate, groupmatch_enddate)
                VALUES
                ('3', '$userv_id', '$current_time', '0')";
        $site_db->query($sql);
       }
       }
      }
//-------------------------------------------------------
//--- END assign user to group after upload x images ----
//-------------------------------------------------------

Please note that you will need to change the values to suit your needs as shown below:

if ($uploaded_images > 4) assign here the number of images they must first upload to qualify for new group. This example requires the user to upload 5 images (a number greater than 4).

Just below that is:
Code:
VALUES
('3', '$userv_id', '$current_time', '0')";


The first number (3, in this case) is the number of the usergroup to which you wish the user assigned.

As an example of how this can be used... I am setting up an image rating site where the requirement is that a person upload 5 images of their own before they are allowed to rate the images uploaded by others. This hack will automatically grant them the permission to vote (only available to a certain usergroup) once they upload their 5th image.

Thanks Mark for the early help.

Posted: Fri Apr 20, 2007 10:01 pm

Western Studios

Site Admin
Site Admin
~PHP Nuke User~

Platinum Subscriber

Posts: 3354
Staff
Next Group: 1646 posts
admin(Mark) wrote:

It looks good Anna and thanks for posting the codes for other members Smile
One thing I should mention is that you should always place your variables in single quote to prevent against sql injections.

Code:
user_id = $userv_id


should be

Code:
user_id = '$userv_id'


Also you can make sure the user id is a number by using intval

Code:
$userv_id= intval($user_info['user_id']);


Posted: Sat Apr 21, 2007 3:06 pm

Post new topic   Reply to topic    Western Studios Forum Index -> 4 Images All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Hundreds of Gmail invites to give away 2 Anna 667 Sat Feb 04, 2006 11:01 am
leachy View latest post
No new posts PHP Nuke klips 0 admin 699 Fri Mar 18, 2005 6:52 pm
admin View latest post
No new posts Paypal success.php 1 Jabba 869 Fri Mar 04, 2005 7:00 pm
admin View latest post
No new posts Testing PHP tags 2 admin 849 Thu Mar 03, 2005 6:06 pm
admin View latest post
No new posts PHP Nuke Icons 0 admin 903 Mon Aug 23, 2004 4:05 pm
admin View latest post
 
Forums ©