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 (Member) 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 15:06

Comments
  #2  
Old 15 Jul 2005, 06:22
Brinnie's Avatar
Brinnie Brinnie is offline
 
Join Date: Jul 2005
Hello, I cannot seem to find the alternate "female" option in your code examples.

How does one go about adding that?
Reply With Quote
  #3  
Old 15 Jul 2005, 06:58
Brinnie's Avatar
Brinnie Brinnie is offline
 
Join Date: Jul 2005
Hello, I just installed it and and it didn't work!

I registered a test account and chose the option "male" as directed in the in instructions, but it stayed in the same group

I uploaded this XML:
<?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'] == 'male')
{
$userdata->set('usergroupid', 12);
}]]></phpcode>
</plugin>
</plugins>
Does it make a difference if I use radio buttons?
Please help

Last edited by Brinnie; 15 Jul 2005 at 07:00.
Reply With Quote
  #4  
Old 15 Jul 2005, 08:20
Brinnie's Avatar
Brinnie Brinnie is offline
 
Join Date: Jul 2005
please help.
Reply With Quote
  #5  
Old 15 Jul 2005, 11:28
Brad Brad is offline
 
Join Date: Nov 2001
There is no need to bump a thread so many times in such a short time peroid.

Did you create a new custom profile field via the admin cp?

http://www.vbulletin.com/docs/html/profile_introduction
Reply With Quote
  #6  
Old 15 Jul 2005, 13:41
Brinnie's Avatar
Brinnie Brinnie is offline
 
Join Date: Jul 2005
Originally Posted by Brad
There is no need to bump a thread so many times in such a short time peroid.

Did you create a new custom profile field via the admin cp?

http://www.vbulletin.com/docs/html/profile_introduction
Yes sir, I did. I used radio buttons. set one to male, set one to female and made it required on registration.

Anything else I could have missed?
Reply With Quote
  #7  
Old 15 Jul 2005, 14:36
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
Make sure you have it case sensitive. Make sure you get the right field number and make sure you have the right user group number.
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #8  
Old 15 Jul 2005, 21:57
Brinnie's Avatar
Brinnie Brinnie is offline
 
Join Date: Jul 2005
Originally Posted by amykhar
Make sure you have it case sensitive. Make sure you get the right field number and make sure you have the right user group number.
yes, it's field number 5, my first custom field.
yes, case is correct.
and im quite sure usergroup 12 is the one I want them to be added to.
the customized usergroup1.xml I posted was exactely what I uploaded into the plugins.

I do not understand why it does not work. Might it be related to the idea that there is no secondary "female" option in your example script?
Reply With Quote
  #9  
Old 15 Jul 2005, 22:11
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
Brinnie, you have to remember 3.5 is beta software. It's working on my test board and my live board. Nobody else has complained that it doesn't work. I don't know why it's not working for you.

And given that you've changed the copyright in your footer, I can't see what version of the beta you are using.
p.s. I'm not entirely certain that your copyright is kosher according to the vbulletin license.
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #10  
Old 16 Jul 2005, 18:44
Brinnie's Avatar
Brinnie Brinnie is offline
 
Join Date: Jul 2005
Originally Posted by amykhar
Brinnie, you have to remember 3.5 is beta software. It's working on my test board and my live board. Nobody else has complained that it doesn't work. I don't know why it's not working for you.

And given that you've changed the copyright in your footer, I can't see what version of the beta you are using.
p.s. I'm not entirely certain that your copyright is kosher according to the vbulletin license.
Amy,

it's a beta 4.
but, i don't want the words "beta" anywhere on my site, so I pwnd it.
Reply With Quote
  #11  
Old 16 Jul 2005, 18:52
Christine's Avatar
Christine Christine is offline
 
Join Date: Nov 2001
Real name: Christine. Really.
Brinnie,

Unless you paid for copyright removal, at the least, the copyright needs to read:

vBulletin, Copyright 2000 - 2005, Jelsoft Enterprises Ltd.

You don't have to keep version information, but the rest is required by Jelsoft.

__________________
L'chaim
Reply With Quote
  #12  
Old 17 Jul 2005, 08:57
Brinnie's Avatar
Brinnie Brinnie is offline
 
Join Date: Jul 2005
Originally Posted by Christine
Brinnie,

Unless you paid for copyright removal, at the least, the copyright needs to read:

vBulletin, Copyright 2000 - 2005, Jelsoft Enterprises Ltd.

You don't have to keep version information, but the rest is required by Jelsoft.

oh well, that's jelsofts problem.
I'm buying the full version next week, so...

anyone have sucess with this on Beta 4?
Reply With Quote
  #13  
Old 17 Jul 2005, 09:07
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Originally Posted by Brinnie
oh well, that's jelsofts problem.
I'm buying the full version next week, so...

anyone have sucess with this on Beta 4?
Wrong this is your problem. You must follow your license agreement.
__________________
Marco van Herwaarden
Ex vBulletin.org Coordinator
Reply With Quote
  #14  
Old 17 Jul 2005, 09:09
Brinnie's Avatar
Brinnie Brinnie is offline
 
Join Date: Jul 2005
Originally Posted by MarcoH64
Wrong this is your problem. You must follow your license agreement.
of course...
Reply With Quote
  #15  
Old 17 Jul 2005, 17:07
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
Originally Posted by Brinnie
oh well, that's jelsofts problem.
I'm buying the full version next week, so...

anyone have sucess with this on Beta 4?
It's running fine for me on Beta 4.
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

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

Layout Options | Width: Wide Color: