Author Topic: if the user upload a picture then autoadd this user to a group. is posible?  (Read 9496 times)

0 Members and 1 Guest are viewing this topic.

Offline Cimmerio

  • Full Member
  • ***
  • Posts: 143
    • View Profile
    • Cartagena en Fotos
Hello.

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

A greeting.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
... all these users into the same usergroup ... ?

PS: ... I have also a very long wishlist ...  :mrgreen:
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Cimmerio

  • Full Member
  • ***
  • Posts: 143
    • View Profile
    • Cartagena en Fotos
... 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

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
... 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 ...
« Last Edit: February 05, 2009, 08:59:04 PM by mawenzi »
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
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."
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
@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:
« Last Edit: February 05, 2009, 03:09:06 AM by mawenzi »
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
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.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Cimmerio

  • Full Member
  • ***
  • Posts: 143
    • View Profile
    • Cartagena en Fotos
Thank you very much for your effort and your help.

The code is working fine.

You rock! 8)

Offline milance

  • Newbie
  • *
  • Posts: 28
    • View Profile
Please if anyone knows to put this at the time validate images and If it is possible for instance to 5 uploads. Thanks  :D

 

Post your comments here