Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
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
Mod Version: 1.00, by amykhar (Coder) amykhar is offline
Developer Last Online: Nov 2013 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 3.5.0 Beta 1 Rating: (10 votes - 5.00 average) Installs: 59
Released: 13 Jun 2005 Last Update: Never Downloads: 249
Not Supported Uses Plugins  

This version is for the PRIMARY group. Here is the one for secondary groups:

http://www.vbulletin.org/forum/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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If, for example, you want to check the value of field6, change field5 in the XML file to field6. If you are looking for "male" instead of "yes", change

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

to:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And, finally, change the usergroup as appropriate. Instead of 10 in this line:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

substiture your usergroupid of choice.

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

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • If you like this modification support the author by donating.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
Add User to Secondary Usergroup Based on the Value of a Custom Profile Field at Reg. amykhar vBulletin 3.5 Add-ons 133 01 Jan 2013 14:06

  #61  
Old 07 Jul 2006, 17:51
ToastBusters ToastBusters is offline
 
Join Date: Dec 2004
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!
Reply With Quote
  #62  
Old 07 Jul 2006, 18:12
paulfletcher paulfletcher is offline
 
Join Date: Jan 2006
Info

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
Reply With Quote
  #63  
Old 07 Jul 2006, 18:16
ToastBusters ToastBusters is offline
 
Join Date: Dec 2004
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.
Reply With Quote
  #64  
Old 07 Jul 2006, 18:19
paulfletcher paulfletcher is offline
 
Join Date: Jan 2006
Hmm...

I don't know off the top of my head what this variable is. You could try contacting vBulletin.com support.

Thanks,
Paul
Reply With Quote
  #65  
Old 11 Jul 2006, 10:58
cddw.ltd cddw.ltd is offline
 
Join Date: Aug 2004
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?
Reply With Quote
  #66  
Old 27 Jul 2006, 11:09
Aurons Ghost Aurons Ghost is offline
 
Join Date: Jul 2006
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?
Reply With Quote
  #67  
Old 02 Aug 2006, 06:24
Neo_obs Neo_obs is offline
 
Join Date: Mar 2006
Real name: Jeff Baldwin
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?

Last edited by Neo_obs : 02 Aug 2006 at 06:57.
Reply With Quote
  #68  
Old 10 Aug 2006, 06:08
Neo_obs Neo_obs is offline
 
Join Date: Mar 2006
Real name: Jeff Baldwin
Can anyone tell me what other hooks I can use this doesnt work on our forums if they activate manually.
Reply With Quote
  #69  
Old 22 Aug 2006, 00:23
rb290's Avatar
rb290 rb290 is offline
 
Join Date: Oct 2005
Originally Posted by Neo_obs
Can anyone tell me what other hooks I can use this doesnt work on our forums if they activate manually.
same deal ^

i dont use email verification so is there any other solution to make this hack work cause i need it...
Reply With Quote
  #70  
Old 26 Aug 2006, 15:50
cavyspirit cavyspirit is offline
 
Join Date: Jan 2004
How is this for 3.6? I absolutely need this one.
Reply With Quote
  #71  
Old 15 Sep 2006, 22:26
kall's Avatar
kall kall is offline
 
Join Date: Apr 2004
Real name: Ace
Working fine for me on 3.6.0 and 3.6.1
__________________
vBulletin Styles (All styles compatible with 3.8.4 - Steel Blue 4.0 Available) | vBulletin Hosting
Reply With Quote
  #72  
Old 21 Sep 2006, 23:53
ricker ricker is offline
 
Join Date: Jun 2003
I thought it wasn't working, but then through troubleshooting I realized that the value of my field couldn't have both numbers and letters. I switched it to just letters and my test account was properly switched into the new usergroup.

If I want to set up multiple "custom registration codes," can I duplicate this script and rename it, changing the values?
__________________
:cheeky: My Jeep Rocks!
Reply With Quote
  #73  
Old 29 Sep 2006, 19:18
kderentz kderentz is offline
 
Join Date: Jan 2005
Originally Posted by kall
Working fine for me on 3.6.0 and 3.6.1
Glad to hear this works on 3.6.1 as that what I plan on using it on.


Amy this hack is exactly what I have been looking for except I have a couple of questions.

I've set up a custom user profile field that asks the user upon registration if they are a reatil buyer or wholesaler and I'm using a radio button to ask them.

Now with your code if they select on item it puts them in a certain user group, but what if they pic the other? do they just go in the default user group?

I want it to place them in eaither group depending on what they pic. I hope this makes sense.
Reply With Quote
  #74  
Old 29 Sep 2006, 19:30
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
This mod is more of a template for you to decide what you want to do with users based on that profle field. You code the logic of where they are sorted. The mod itself hooks to the right place and gets you started so you can see how to inspect the value of the field and how to put the user in a group.
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #75  
Old 29 Sep 2006, 19:39
kderentz kderentz is offline
 
Join Date: Jan 2005
Originally Posted by amykhar
This mod is more of a template for you to decide what you want to do with users based on that profle field. You code the logic of where they are sorted. The mod itself hooks to the right place and gets you started so you can see how to inspect the value of the field and how to put the user in a group.
Thats where im limited as my code knowledge is lacking

Could you help me out with this ...

say my user field is 5 and my options are Dealer or End User

my user group for Dealers is 10 and my user group for End Users is 11

would my code look something like this???:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 18:52.

Layout Options | Width: Wide Color: