MyBB Community Forums

Full Version: "[Auto Usergroup Change] For Age" - Still Compatible With 1.6?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Thread Name: [Auto Usergroup Change] For Age
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
If you have a lot of members that query is a killer.

It might work - best to test it on your local host first.
We only have 1700 members, guess that qualifies as enough to lag it. Shame, all the other codes online require you to pay $10-20 for a plugin. I'll just ice the idea for now, lagging the site is not acceptable after all the hosting issues we had last year.

Again, cheers Leefish