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