2006-06-20, 11:36 PM
2006-06-21, 11:47 AM
Hello there, um it would have been better if you had specified if you want different age ranges or just one, i have coded based on 1 age, example <16 or >16
open ./global.php
find
above add
open ./global.php
find
$plugins->run_hooks("global_end");
above add
$age_crumb = 16;//deadline age
$young_group = 3;//group for people younger that the deadline
$old_group = 4;//group for those who are elder
$age_check = $db->query("SELECT uid, birthday FROM ".TABLE_PREFIX."users WHERE usergroup='2' AND birthday LIKE '__-__-____' OR birthday LIKE '_-_-____' OR birthday LIKE '__-_-____' OR birthday LIKE '_-__-____'");
while($age_ex = $db->fetch_array($age_check))
{
if(get_age($age_ex['birthday']) >= $age_crumb)
{
$db->query("UPDATE ".TABLE_PREFIX."users SET usergroup='$old_group' where uid='".$age_ex['uid']."'");
}
elseif(get_age($age_ex['birthday']) < $age_crumb)
{
$db->query("UPDATE ".TABLE_PREFIX."users SET usergroup='$young_group' where uid='".$age_ex['uid']."'");
}
}
- $age_crumb: is the age which you want to check whether a member is younger or elder than it.
- $young_group: is the group the youngers will be moved to.
- $old_group: is the group the elder will be moved to.
2006-06-21, 02:08 PM
Thank zaher1988, sorry for not specifing the age, but 16 was the age I wanted which is great, thank you again
2006-06-21, 03:13 PM
Sorry for the double post but this is the only way of showing that I have replied, unlike if I edited the above post, again sorry.
zaher1988 I am having problems with the code because it changes everyone that is 16 which is a problem since it is changing my super mods from the 'super mod' group to '16+' group and it can not be stopped, is there a way to limit it to saying, only people that are in the group 'registered' will change if they are 16?
zaher1988 I am having problems with the code because it changes everyone that is 16 which is a problem since it is changing my super mods from the 'super mod' group to '16+' group and it can not be stopped, is there a way to limit it to saying, only people that are in the group 'registered' will change if they are 16?
2006-06-21, 03:22 PM
Well, are you sure you are using that code? since it should only get the persons which is in the registered usergroup, make he updated it.
WHERE usergroup='2'
WHERE usergroup='2'
2006-06-21, 03:43 PM
I thought so too, but I don't know why, but it does, and it seems to not let me move the users back into the right group
[update]
It does let me change where the user is, however once someone loads the index page, whic intern loads global.php the user changes back
I tested it out on a Super Mod, I changed him from the 16+ group back to super mod, but then once the index page loaded he went back the the 16+ group
[update]
It does let me change where the user is, however once someone loads the index page, whic intern loads global.php the user changes back
I tested it out on a Super Mod, I changed him from the 16+ group back to super mod, but then once the index page loaded he went back the the 16+ group
2006-06-21, 03:54 PM
maybe your super mods has this group as an additional, and their main usergroup is registred.
regards
regards
2006-06-21, 03:59 PM
Try this instead then.
$age_crumb = 16;//deadline age
$young_group = 3;//group for people younger that the deadline
$old_group = 4;//group for those who are elder
$age_check = $db->query("SELECT uid, birthday, usergroup, additionalgroups FROM ".TABLE_PREFIX."users WHERE usergroup='2' AND birthday LIKE '__-__-____' OR birthday LIKE '_-_-____' OR birthday LIKE '__-_-____' OR birthday LIKE '_-__-____'");
while($age_ex = $db->fetch_array($age_check)) {
if($age_ex['usergroup'] == 2 && $age_ex['additionalgroups'] == '') {
if(get_age($age_ex['birthday']) >= $age_crumb) {
$db->query("UPDATE ".TABLE_PREFIX."users SET usergroup='$old_group' where uid='".$age_ex['uid']."'");
} else if(get_age($age_ex['birthday']) < $age_crumb) {
$db->query("UPDATE ".TABLE_PREFIX."users SET usergroup='$young_group' where uid='".$age_ex['uid']."'");
}
}
}
2006-06-21, 04:06 PM
Thank you CraKteR.
Your code works perfectly, thanks
Your code works perfectly, thanks
2006-06-21, 04:08 PM
Your very welcomed