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 |
#32
|
||||
|
||||
Nobody has seniority at registration time, so no. This mod can't help you. You can use the built in promotion system, I believe.
Amy |
#33
|
|||
|
|||
Quote:
Marry Me? Rabbit (with respect) |
#34
|
||||
|
||||
Doh. Sorry for my stupid initial response. Let me look at it a bit and get back to you. I'm multitasking right now.
|
#35
|
|||
|
|||
Quote:
Quote:
Thx Will Check Back LATER!! Rabbit |
#36
|
|||
|
|||
Quote:
|
#37
|
|||
|
|||
Nice mod I wondered how to do this.
I'm using this mod to ask the user if they wish to receive the site newsletter or not. This works fine on registration but they can't change their minds. So I added the option and two plugin's for the user to select yes or no on update profile. The problem I'm having is it does not always work I have to select Yes or No and save twice for the plugin to actually do the job of moving the user from one group to the other. Is there anyway to combine these two options into one and is there a more sure way to ensure that the update actually occurs? Hook Location profile_updateprofile // 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', 2); } AND // Get the value for field 5 $user = $db->query_first(" SELECT field5 FROM " . TABLE_PREFIX . "userfield WHERE userid = " . $vbulletin->userinfo['userid'] . " "); if ($user['field5'] == 'No') { $userdata->set('usergroupid', 44); } |
#38
|
|||
|
|||
Hey there,
This is exactly what I want to do, but I'm having a little trouble with it. I'm checking the correct field for the correct value (field6 is populating properly & I'm checking for the right values). It's hooked at the right place, register_activate_process. I am using vB 3.5.2 - is that the problem? If so, any thoughts on how to get this to work? Here's the code I'm using: 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 6 $user = $db->query_first(" SELECT field6 FROM " . TABLE_PREFIX . "userfield WHERE userid = " . $vbulletin->userinfo['userid'] . " "); if ($user['field6'] == 'chicago') { $userdata->set('usergroupid', 11); } if ($user['field6'] == 'cincinnati') { $userdata->set('usergroupid', 10); } if ($user['field6'] == 'indianapolis') { $userdata->set('usergroupid', 9); } ]]> </phpcode> </plugin> </plugins> When I click the activation link in the email, a blank window pops up with this address... http://www.mydomain.com/forums/regis...=15&i=80639843 ...but it freezes there. The user gets activated, but is not assigned to the desired usergroup. Thanks a bunch for any help. |
#39
|
|||
|
|||
fixed
|
#40
|
|||
|
|||
Great plugin Amy!
I'm wondering if you (or any other able person) would help me? I want to use the plugin, but I don't have email verification turned on. What do I need to change to make this work without email verification? Val |
#41
|
|||
|
|||
Can anyone help me?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|