Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TassieAnna

Pages: [1]
1
Slightly disappointed that nobody attempted to assist with this, especially as it was not a difficult modification. Though it did prove tricky to get fully functional in the end.

The basic idea was that I wanted to disallow voting on images until the user had uploaded 5 of their own. Voting was restricted to a new usergroup that I created, and the details below show how to assign a user automatically to a usergroup.

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: [Select]
  $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: [Select]
//-------------------------------------------------------
//--- 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: [Select]
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.


2
I have seen that others mentioned they have done this, and am hoping there is an easy way to achieve it, already published somewhere here. Though my searches and browsing have not uncovered this.

What I would like to achieve is have a user promoted to a new group after uplaoding 5 images. This would then grant them extra permissions, etc.

I want to avoid having to insert database queries over and over again, so that once they are promoted, there is no need to check again.

Has anyone a simple modification that will achieve this? I am using version 1.7.4

Any help would be greatly appreciated.

thank you

edit:

I have been playing at trying to make the following code work, but keep getting an error regarding the last )

Code: [Select]
  $sql = "SELECT COUNT(image_id) AS totimg
         FROM ".IMAGES_TABLE."
         WHERE  user_id = $user_id";
  $result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$uploaded_images = $row['totimg'];
if ($uploaded_images ==5) {
 $sql = "INSERT INTO ".GROUP_MATCH_TABLE."
                (group_id, user_id, groupmatch_startdate, groupmatch_enddate)
                VALUES
                (3, $user_id, $current_time, 0)";
        $site_db->query($sql);
)

Also, I have been trying to insert this into member.php around the point after an image is uploaded.

I am also thinking that this does not first check to see if the user has already been entered into the group.

Currently returning to ripping my hair out, as this is the last thing I need to organise before letting my site go live.

3
Chit Chat / Hi & Thank You
« on: April 19, 2007, 04:21:25 AM »
Hi

Just wanted to say thank you to the developers of 4images, and the excellent range of modifications available for this gallery.

Only installed this script yesterday, and am still playing around with getting it modified to do what I want, but it looks as though the script has been so cleanly written, that this will not pose too many problems.

I have spent the past week testing various commercial and open source scripts to try and achieve a particular end result, and this is the ONLY one I have found that looks as though it will perform exactly how I want it to.

An excellent script, and thank you once again.

Pages: [1]