The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
check usergroup of user
how do i check what usergroup a user is a member of?
|
#2
|
||||
|
||||
<if condition="is_member_of($bbuserinfo, 5,6,7)">
|
#3
|
|||
|
|||
thank you very much.
--------------- Added [DATE]1207102264[/DATE] at [TIME]1207102264[/TIME] --------------- need a bit of help please.. keep getting the error: Parse error: syntax error, unexpected '<' in /home/slothdog/domains/weedtracker.com/public_html/forums/profile.php(842) : eval()'d code on line 9 I guess i cant put conditionals into a plugin? I want to check the usergroup and if they are in certain usergroups move them to a secondary group and if they are in other groups move them to a primary usergroup if they answer 'yes' to a custom profile field. and if they answer 'no' to move them back to a different primary usergroup. i hacked this from the primary and secondary usergoup based on profile field plugin. i want to combine the two into a single plugin. this is what ive come up with (im not much of a coder these days): Code:
// Get the value for field 9 $user = $db->query_first(" SELECT field9 FROM " . TABLE_PREFIX . "userfield WHERE userid = " . $vbulletin->userinfo['userid'] . " "); // YES ANWSERS <if condition="is_member_of($bbuserinfo, 23,33,43)"> if ($user['field9'] == 'yes') { $membergroupids = $userdata->fetch_field('membergroupids'); if ($membergroupids) { $membergroupids = $membergroupids . ", 41"; } else { $membergroupids = 41; } $userdata->set('membergroupids', $membergroupids); } </if> <if condition="is_member_of($bbuserinfo, 2,24)"> if ($user['field9'] == 'yes') { $userdata->set('usergroupid', 41); } </if> // NO ANWSERS if ($user['field9'] == 'no') { $userdata->set('usergroupid', 24); } |
#4
|
||||
|
||||
I didn't know you were using it in php. I thought it was a template. It should be like this then:
Code:
// Get the value for field 9 $user = $db->query_first(" SELECT field9 FROM " . TABLE_PREFIX . "userfield WHERE userid = " . $vbulletin->userinfo['userid'] . " "); // YES ANWSERS if (is_member_of($vbulletin->userinfo, 23,33,43)) { if ($user['field9'] == 'yes') { $membergroupids = $userdata->fetch_field('membergroupids'); if ($membergroupids) { $membergroupids = $membergroupids . ", 41"; } else { $membergroupids = 41; } $userdata->set('membergroupids', $membergroupids); } } if (is_member_of($vbulletin->userinfo, 2,24)) { if ($user['field9'] == 'yes') { $userdata->set('usergroupid', 41); } // NO ANWSERS if ($user['field9'] == 'no') { $userdata->set('usergroupid', 24); } } |
#5
|
|||
|
|||
oh duh i should have known that! vbulletin confuses me so much sometimes on when to use templates and when to use php. thanks for the help.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|