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

  #31  
Old 08 Nov 2005, 21:05
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
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
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #32  
Old 08 Nov 2005, 21:23
silly rabbit silly rabbit is offline
 
Join Date: Oct 2005
Real name: Kiera
Originally Posted by amykhar
Nobody has seniority at registration time . . .
Amykhar, already have 'senority' as a required 'custom' field upon registration?? Granted don't have 'input verification' yet . . .

Marry Me? Rabbit (with respect)

Last edited by silly rabbit; 08 Nov 2005 at 21:25. Reason: Next Page - my bad . .
Reply With Quote
  #33  
Old 08 Nov 2005, 21:25
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
Doh. Sorry for my stupid initial response. Let me look at it a bit and get back to you. I'm multitasking right now.
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #34  
Old 08 Nov 2005, 21:28
silly rabbit silly rabbit is offline
 
Join Date: Oct 2005
Real name: Kiera
Originally Posted by amykhar
Let me look at it a bit and get back to you. I'm multitasking right now. . . .
No Problem!!!

Originally Posted by amykhar
You can use the built in promotion system
I'm Not READING either - need to check out as well(if referring to 'posts' have already)

Thx Will Check Back LATER!!

Rabbit
Reply With Quote
  #35  
Old 08 Nov 2005, 21:36
lazyseller lazyseller is offline
 
Join Date: Oct 2003
Originally Posted by amykhar
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
Thanks... for responding i have found a solution for this ..

Last edited by lazyseller; 13 Nov 2005 at 05:52.
Reply With Quote
  #36  
Old 10 Nov 2005, 13:47
webspider webspider is offline
 
Join Date: Jun 2003
Question

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);
}
Reply With Quote
  #37  
Old 30 Dec 2005, 07:24
Token55 Token55 is offline
 
Join Date: Dec 2005
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:


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

The values for field6 are set up to be all lowercase.

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.
Reply With Quote
  #38  
Old 25 Jan 2006, 01:17
Crrrazzzy Crrrazzzy is offline
 
Join Date: Sep 2005
fixed

Last edited by Crrrazzzy; 25 Jan 2006 at 05:48.
Reply With Quote
  #39  
Old 29 Jan 2006, 19:20
Valentino Valentino is offline
 
Join Date: Jan 2006
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
Reply With Quote
  #40  
Old 11 Feb 2006, 16:51
Valentino Valentino is offline
 
Join Date: Jan 2006
Can anyone help me?
Reply With Quote
  #41  
Old 14 Feb 2006, 19:56
Valentino Valentino is offline
 
Join Date: Jan 2006
Please...
Reply With Quote
  #42  
Old 16 Feb 2006, 22:18
Valentino Valentino is offline
 
Join Date: Jan 2006
C'mon, who do I have to kiss to get some help?
Reply With Quote
  #43  
Old 28 Feb 2006, 15:28
paulfletcher paulfletcher is offline
 
Join Date: Jan 2006
Question Parse Error

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
Attached Images
File Type: png Picture 1.png (13.4 KB, 41 views)
Reply With Quote
  #44  
Old 10 Mar 2006, 21:10
paulfletcher paulfletcher is offline
 
Join Date: Jan 2006
Has anyone got this to work on 3.5.4, and would like to help me out?

Thanks,
Paul
Reply With Quote
  #45  
Old 11 Mar 2006, 02:50
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
Paul, it's been running on my board since the early betas and still works on 3.5.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 04:17.

Layout Options | Width: Wide Color: