The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Add User to Primary Usergroup Based on Value of Custom Profile Field Details »» | |||||||||||||||||||||||||||
Add User to Primary Usergroup Based on Value of Custom Profile Field
Developer Last Online: Nov 2013
This version is for the PRIMARY group. Here is the one for secondary groups:
https://vborg.vbsupport.ru/showthread.php?t=82993 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 primary user group based on that selection. This happens at the time the user activates their email account after registering. 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. Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <plugins> <plugin active="1" product="vbulletin"> <title>Put User In User Group Based on 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'] == 'yes') { $userdata->set('usergroupid', 10); }]]></phpcode> </plugin> </plugins> Code:
if ($user['field5'] == 'yes') Code:
if ($user['field5'] == 'male') Code:
$userdata->set('usergroupid', 10); 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. Amy Show Your Support
|
Comments |
#62
|
|||
|
|||
Hey,
I would like to have a the usergroup be based on the email domain. i.e. if the register with one domain they get put in a special usergroup but if it's any other domain they are simply put into registered users. Is this possible with this plugin? Thanks! |
#63
|
|||
|
|||
Hello. You can definitely set it up so if a user is from a certain domain they get put into a special user-group. You just setup a text field, and point this script towards this text field, and your good to go. You could probably setup the script to do an "if and or" statement. If it's from this domain do this, otherwise do this. But I'm not the person to ask about how to program this... But it can be done.
Thanks, Paul |
#64
|
|||
|
|||
Do you know off the top of your head what the variable is that holds the users email address? I could just get the domain off of that.
|
#65
|
|||
|
|||
I don't know off the top of my head what this variable is. You could try contacting vBulletin.com support.
Thanks, Paul |
#66
|
|||
|
|||
Anyone got any links to a similar system that would allow users to either switch their primary usergroup or secondary at any time via the control panel?
|
#67
|
|||
|
|||
Thank you for this mod. It was just what I was looking for
on a side note though, if you don't have email confirmation, do you know which hook to use? |
#68
|
|||
|
|||
I have a question is there anyway to mass add the users that have already registered to that usergroup?
if i ran this as a cron would it do it? // Get the value for field 11 $user = $db->query_first(" SELECT field11 FROM " . TABLE_PREFIX . "userfield WHERE userid = " . $vbulletin->userinfo['userid'] . " "); if ($user['field11'] == 'No') { $userdata->set('usergroupid', 18); } or if i add it as a hook somewhere else on the site? like forumhome? |
#69
|
|||
|
|||
Can anyone tell me what other hooks I can use this doesnt work on our forums if they activate manually.
|
#70
|
||||
|
||||
Quote:
i dont use email verification so is there any other solution to make this hack work cause i need it... |
#71
|
|||
|
|||
How is this for 3.6? I absolutely need this one.
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|