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 |
#22
|
|||
|
|||
Quote:
|
#23
|
||||
|
||||
Not going to get a response from that user. She was banned.
|
#24
|
|||
|
|||
Hi amykhar, if anytime after registration, a user changes the profile field from A to B, will the primary usergroup of that user also change without any approval from the admin side?
I am looking for something that allows a user to change usergroup without the need to wait for approval |
#25
|
||||
|
||||
No. It will not change. This affects registrations only. All you have to do with regards to the no approval needed is to not set up a group leader.
|
#26
|
|||
|
|||
Great! Thanks, and I will still have use for your hack.
|
#27
|
||||
|
||||
Before I dig into your code, off the top of your head, do you think I can modify this so that the primary usergroup is set based on the email domain? I have users from a certain domain (my work) who I want to have automatically moved into a primary usergroup with greater permissions. Thanks!
|
#28
|
|||
|
|||
I know that Brinnie is banned, but if anyone else is having a problem like her's, make sure that
Code:
if ($user['field5'] == 'yes') I think Amy said that somewhere in here too. |
#29
|
|||
|
|||
I have an idea for cobranding but unsure how to implement this
is there a way to set usergroup based on $styleid ? for example if styleid = 2 usergroup will be 10 ? Any help would be appreciated |
#30
|
||||
|
||||
It sounds like if a user registers from one domain, you want them to see one style and one set of forums and if they register from another domain, you want them to see a different style and set of forums. Is that what you are going for?
Amy |
#31
|
|||
|
|||
Quote:
Have quick 2 Qs 1'st to ensure I get it right - am new to php/HTML but if I want to divide new regs into one of three different employee groups based on senority date(ie: less than 5 yrs, 5 - 15yrs and 15yrs+)? Q1 -> whats the HTML/PHP 'format' entry to ensure date entered is in correct format of '122505'(Christmas day)?? Q2 -> is this 'doable' here for me?? Thx In advance, Rabbit |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|