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 |
#42
|
|||
|
|||
Please...
|
#43
|
|||
|
|||
C'mon, who do I have to kiss to get some help?
|
#44
|
|||
|
|||
Can someone help me, I added this plugin to our website (XYZ Training) and when clicking on the activation link that is sent automatically to your email account I get a parse error. (See Attachment)
I think I installed the plugin correctly, and I made sure I enter the correct information into the code before I uploaded the xml file. I double checked the group ID, and the usergroup ID. I also verified the contents that will be entered into the text field. Thanks, Paul |
#45
|
|||
|
|||
Has anyone got this to work on 3.5.4, and would like to help me out?
Thanks, Paul |
#46
|
||||
|
||||
Paul, it's been running on my board since the early betas and still works on 3.5.4
|
#47
|
|||
|
|||
Thanks for getting back to me. I wasn't sure if it still worked for 3.5.4. I'm working on an Activation Code text field that would appear during registration. This would allow for a community license to be issued to a school or company (we will be creating video tutorials).
After talking to other users they suggested that I use the secondary usergroup script that you created, this would allow me to easily demote a group of users back to a normal registered usergroup if needed. Will your primary or secondary script that you created work with text fields? Or only Radio & Check boxes? Thanks, Paul |
#48
|
||||
|
||||
text fields will work as well.
|
#49
|
|||
|
|||
amykhar, you wrote:
Code:
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.
(Btw: I tried but it doesnt go) |
#50
|
|||
|
|||
Is it possible to assign an user to an usergroup depending the value of the profile field after they have registered?
Let me explain. I run a hosting forum and some members don't even use their hosting account. I send out an email telling that they haven't used their (sub)domain and that need to reply to the email. After I send the email I edit their profile and select "Warned" from the drop down list. I also have "Suspended" (from the hosting) and "Terminated". |
#51
|
||||
|
||||
It's possible to do it, just not with this mod.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|