makaiguy |
06-06-2006 03:29 AM |
Amazing. It worked right out of the box with no debugging at all. Must have held my mouth just right while coding, or something. Anyhow, here's what to use as the control in place of the ones in the downloadable autojoin.txt file:
PHP Code:
// Add or remove user from secondary usergroup // according checkboxes selected in user's profile // Ver 1.4
global $vbulletin;
// Enter values in the strings below for your forum // number of the custom field containing your checkboxes $boxes_field = 'fieldX'; // Usergroup number for FIRST checkbox option $ug[0] = 'X'; // Usergroup number for SECOND checkbox option $ug[1] = 'Y'; // add additional checkbox options as needed
// You need make no changes below here // Derive additional needed variables // userid of user $userid = ($vbulletin->userinfo['userid']); // current usergroups as array $ugarr = explode(',' , (''.$vbulletin->userinfo['membergroupids'])); // boxes selected if ($vbulletin->userinfo[$boxes_field] == '') { $fieldval = 0; } else { $fieldval = $vbulletin->userinfo[$boxes_field]; }
// Do the work $iii = 0; foreach ($ug as $value) { if ($fieldval & pow(2, $iii)) { $ugarr = IntoGroup($ugarr, $ug[$iii], $userid); } else { $ugarr = OutOfGroup($ugarr, $ug[$iii], $userid); } $iii++; }
.. then just add in the code for the two functions as in the downloaded autojoin.txt file.
I'll get this added to the autojoin.txt file real soon now ...
[Edit:] Has now been added to the downloadable autojoin.txt file, as version 1.05.
|