![]() |
|
|
Mod Options |
Add User to Secondary Usergroup Based on the Value of a Custom Profile Field at Reg. Details »»
|
|||||||||||||||||||||||||||||||||||
|
Add User to Secondary Usergroup Based on the Value of a Custom Profile Field at Reg.
Developer Last Online: Oct 2012
This version is for the SECONDARY group. The one for primary groups is here:
http://www.vbulletin.org/forum/showthread.php?t=82992 As far as plugins goes, this one is an advanced plugin because you WILL need to make some tweaks to suit your needs. What this plugin does: If you have a custom profile field, for example one for gender, it checks to see if the user has selected a specific value and then assigns them to a secondary user group based on that selection. Instructions for installation: A. Create your custom profile field and make a note of the field number. (Or simply make a note of the field number of an existing field.) B. Make a note of the value you are checking for. For example, you may be looking to see if your member selected "male" in your custom gender field. C. Make a note of the usergroup number that you want to set the user to. D. Here you have two options: Option 1: Edit the attached XML file before you import it to change the field number, the value that you check for and the usergroupid. In my XML file, I am checking field5 to see if the value is yes and changing the usergroup to 10.
If you are checking field10 instead of field5, change all references of field5 to field10. Example: if you are checking your field to see if the value is male, you would change (change field number as needed):
to:
And, finally, change the usergroup as appropriate. Instead of 10 in this line:
substiture your usergroupid of choice. And in this line as well,
Option 2: Import the XML file as is, open the plugin manager, and make your edits there. NOTE: This mod works for forums that require users to verify their email address upon registration. If your forum does not require users to verify their email address, you will need to use a different hook. If I have time, I'll test that variation. ---------------- Example Gender Mod that separates users into secondary groups based on their gender. Don't forget, the values are case sensitive and the field numbers and usergroup numbers need to be changed to suit your site's setup.
Amy Download Now Only licensed members can download files, Click Here for more information. Show Your Support
No members have liked this post.
|
|||||||||||||||||||||||||||||||||||
Similar Mod
|
||||
| Mod | Developer | Type | Replies | Last Post |
| Add User to Primary Usergroup Based on Value of Custom Profile Field | amykhar | vBulletin 3.5 Add-ons | 128 | 07 May 2013 15:06 |
|
#121
|
|||
|
|||
|
Any way to make this happen any time they change fields, not just on registration?
__________________
Mummybrain.com We're virtually family No members have liked this post.
|
|
#122
|
|||
|
|||
|
I'm trying to get this mod to work on VB4.0 but it does not seem to work anymore. Would you be willing to modify the mod for vb4?
The relevant hook is still there I noticed. I especially need the gender example you posted in your original post. Thanks in advance! Regards, Walrick No members have liked this post.
|
|
#123
|
|||
|
|||
|
Same here.. I am in need of this hack.
No members have liked this post.
|
|
#124
|
||||
|
||||
|
Installed on vBulletin 4.0.3 PL1 and is perfect !
__________________
- No members have liked this post.
|
|
#125
|
||||
|
||||
|
I had this mod working perfect until we updated to 4.1, I would be willing to donate if this could be updated please! I use it for the gender example and it was working great!
No members have liked this post.
|
|
#126
|
||||
|
||||
|
I have a need for this too
Would be great if it could be updated.No members have liked this post.
|
|
#127
|
|||
|
|||
|
I would also love an update on this mod, if you would be so kind.
![]() Tagged for now, I eagerly await your (hopeful) enthusiasm to rework it! =D No members have liked this post.
|
|
#128
|
|||
|
|||
|
i need this mod for vb4
__________________
Morocco Community www.rkempo.nl No members have liked this post.
|
|
#129
|
|||
|
|||
|
need a fix for 3.8.7 please!!!!!
No members have liked this post.
|
|
#130
|
||||
|
||||
|
No members have liked this post.
|
|
#131
|
|||
|
|||
|
Same here.
Would be willing to donate.No members have liked this post.
|
|
#132
|
|||
|
|||
|
I need this mod for vB4 too... I would pay for it
No members have liked this post.
|
|
#133
|
||||
|
||||
|
It shouldn't be too hard to get this running, it's just a simple sql query more or less.
Couldn't one of the coders here give a hint? No members have liked this post.
|
|
#134
|
|||
|
|||
|
Hi!
I figured out how to modify the code. The code works fine when it is inserted after line 1507. This is just behind the hook "($hook = vBulletinHook::fetch_hook('register_activate_process')) ? eval($hook) : false;" The code is: // Get the value for field 5 $user = $db->query_first("SELECT field5 FROM " . TABLE_PREFIX . "userfield WHERE userid = $userinfo[userid]"); if ($user['field5'] == 'Test') { $membergroupids = $userdata->fetch_field('membergroupids'); if ($membergroupids) { $membergroupids = 9; } else { $membergroupids = 9; } $userdata->set('membergroupids', $membergroupids); } My prob is, that it does not work when I use it as a plugin. Could anybody help? I guess .... but it did'nt work <?xml version="1.0" encoding="ISO-8859-1"?> <plugins> <plugin active="1" product="vbulletin"> <title>Put User in Secondary Group Based on Custom Profile Field Value</title> <hookname>register_activate_process</hookname> <phpcode><![CDATA[// Get the value for field 5 $user = $db->query_first("SELECT field5 FROM " . TABLE_PREFIX . "userfield WHERE userid = " . $vbulletin->userinfo['userid'] . ""); if ($user['field5'] == 'Mathebuch') { $membergroupids = $userdata->fetch_field('membergroupids'); if ($membergroupids) { $membergroupids = 9; } else { $membergroupids = 9; } $userdata->set('membergroupids', $membergroupids); $userdata->save(); }]]></phpcode> </plugin> </plugins> No members have liked this post.
|
![]() |
«
Previous Mod
|
Next Mod
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
| Mod Options | |
|
|
| New To Site? | Need Help? |
All times are GMT. The time now is 15:24.





Would be great if it could be updated.
