4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: Cimmerio on February 04, 2009, 10:46:50 PM

Title: if the user upload a picture then autoadd this user to a group. is posible?
Post by: Cimmerio on February 04, 2009, 10:46:50 PM
Hello.

I wish to do this in my web. exit any mod like this?

A greeting.
Title: Re: if the user upload a picture then autoadd this user to a group. is posible?
Post by: mawenzi on February 04, 2009, 10:53:58 PM
... all these users into the same usergroup ... ?

PS: ... I have also a very long wishlist ...  :mrgreen:
Title: Re: if the user upload a picture then autoadd this user to a group. is posible?
Post by: Cimmerio on February 04, 2009, 11:04:46 PM
... all these users into the same usergroup ... ?

PS: ... I have also a very long wishlist ...  :mrgreen:

Yes, in the same group jeje.

Sorry for my bad english, i'm spanish :P
Title: Re: if the user upload a picture then autoadd this user to a group. is posible?
Post by: mawenzi on February 04, 2009, 11:48:48 PM
... so let's try this ...
... in member.php in section "if ($action == "uploadimage")"  find two times ...
Code: [Select]
$result = $site_db->query($sql);

1.time for "if ($direct_upload)" ...
2.time for "else" ...

... and add each time after ... *)
Code: [Select]
//--- start --- user-ID in "uploader_group" ---
$uploader_group_id = "XX"; // here the number of the group_id of your "uploader_group"

if ($user_info['user_level'] > GUEST)
{
  $sql = "SELECT group_id
          FROM ".GROUP_MATCH_TABLE."
          WHERE group_id = ".$uploader_group_id." AND user_id = ".$user_info['user_id'];
  $result = $site_db->query_firstrow($sql);
 
  if (!$result)
  {
    $sql = "INSERT INTO ".GROUP_MATCH_TABLE."
            (group_id, user_id, groupmatch_startdate, groupmatch_enddate)
            VALUES
            ($uploader_group_id, ".$user_info['user_id'].", ".time().", 0)";
    $result = $site_db->query($sql);
  }
}
//--- end --- user-ID in "uploader_group" ---

*) for simplifying see V@nos post ...

... and ofcourse replace XX  with the number of the group_id of your "uploader_group" ...
... and every upload-user is added only one time in your "uploader_group" ...
... not tested and can certainly be optimized ...
Title: Re: if the user upload a picture then autoadd this user to a group. is posible?
Post by: V@no on February 05, 2009, 02:18:56 AM
To simplify the instructions, insert the code

above
Code: [Select]
        $sql = "INSERT INTO ".IMAGES_TABLE."
and
above
Code: [Select]
        $sql = "INSERT INTO ".IMAGES_TEMP_TABLE."
Title: Re: if the user upload a picture then autoadd this user to a group. is posible?
Post by: mawenzi on February 05, 2009, 02:48:20 AM
@V@no ...

1. thanks for optimizing ... ;)

2. to simplify ... ofcourse, above is the simplier way ... ;)

3. for "groupmatch_startdate" and "groupmatch_enddate" ... ?
... are you shure about that ... ".time()."and "0" ... ?
... and what about if this dates are already exist for the existing "uploader_group" ... ?
... or are this dates individual dates for every user ... ?

edit :
3. for "groupmatch_startdate" and "groupmatch_enddate" ...
... I checked these dates in ACP ... they are individual dates for every user ... !
... as always ... you are right ...  :mrgreen:
Title: Re: if the user upload a picture then autoadd this user to a group. is posible?
Post by: V@no on February 05, 2009, 03:20:34 AM
Yes, these dates individual for each match (member + group).
Using groupmatch_startdate and groupmatch_enddate you can control when the group for this user will be activated and when it will expire. When groupmatch_enddate is to "0" - it means no expiration, the user will stay in that group forever.

(btw, I just learned about this feature myself..didn't know it existed. Very useful feature!)



P.S.
Because groupmatch table doesn't have "unique" attribute in the fields you can insert as many entries with identical data as you wish, with no error.
Title: Re: if the user upload a picture then autoadd this user to a group. is posible?
Post by: Cimmerio on February 05, 2009, 08:06:59 PM
Thank you very much for your effort and your help.

The code is working fine.

You rock! 8)
Title: Re: if the user upload a picture then autoadd this user to a group. is posible?
Post by: milance on May 30, 2013, 07:03:59 AM
Please if anyone knows to put this at the time validate images and If it is possible for instance to 5 uploads. Thanks  :D