2013-01-31, 10:12 AM
Thread Name: [Auto Usergroup Change] For Age
Thread URL: http://community.mybb.com/thread-9910.html
Adding the following to ./global.php before
I'm concerned that if I run this and it is not compatible with 1.6 then it will mess up my group system in place. We use a group for each Clan that operates off our site, mucking that system up would cripple us for months.
Thanks for your input,
Cru
Thread URL: http://community.mybb.com/thread-9910.html
Adding the following to ./global.php before
$plugins->run_hooks("global_end");
$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']."'");
}
}
}
I'm concerned that if I run this and it is not compatible with 1.6 then it will mess up my group system in place. We use a group for each Clan that operates off our site, mucking that system up would cripple us for months.
Thanks for your input,
Cru