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

  #16  
Old 01 Aug 2005, 22:16
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Real name: Anton Kanevsky
I don't think you need the select query. I mean, the custom fields get passed on by the POST method. They should already be somewhere in the script. Get the values from there.
__________________
I can no longer support any of my hacks. Please do not contact me for that. Feel free to create and post new versions of my hacks, as long as you give me credit for the original work.
Reply With Quote
  #17  
Old 02 Aug 2005, 16:03
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
You would think so, wouldn't you. But, if you look at the code, you'll see that what's passed in to the activation routine are two things: The username and the activation id.

Using the username, the code gets the userinfo BUT not all of it. It only gets what's in the user table. It doesn't get the profile fields. And, it never does a call to fetch_userinfo(). (Which would result in a query as well.)

If I weren't doing this as a plugin, I would have changed the query to do a left join and get the profile field stuff. But, I'm doing this as a plugin and can't change the query. Hence, the second query.

Amy
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #18  
Old 02 Aug 2005, 16:17
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Real name: Anton Kanevsky
Ah... Sorry, I did not notice that you were hooking it into the activation section. I thought you added the group right upon registration... :P
__________________
I can no longer support any of my hacks. Please do not contact me for that. Feel free to create and post new versions of my hacks, as long as you give me credit for the original work.
Reply With Quote
  #19  
Old 02 Aug 2005, 16:22
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
Nope. I don't want unactivated users in secondary user groups.

I figured it was safer this way for all concerned because not everybody understands how secondary usergroup permissions work. They could end up with some nasty surprises by putting somebody in a secondary usergroup that has priv to post, view attachments, or whatever.

Yes, the answer is to severely limit secondary groups, but not everybody knows to do that.

Amy
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #20  
Old 07 Oct 2005, 02:02
justindwhite justindwhite is offline
 
Join Date: Apr 2005
Real name: Justin
I am getting a Parse error when the user tries to activate their account. Here is the plugin I used. Is everything OK? Anyone know the problem?


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

Reply With Quote
  #21  
Old 17 Oct 2005, 21:52
TheElf TheElf is offline
 
Join Date: Aug 2004
Originally Posted by Brinnie
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?
The whole plugin system is disabled by default, have you enabled it?
Reply With Quote
  #22  
Old 18 Oct 2005, 02:27
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
Not going to get a response from that user. She was banned.
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #23  
Old 29 Oct 2005, 04:41
rookiyong rookiyong is offline
 
Join Date: Apr 2005
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

Last edited by rookiyong; 29 Oct 2005 at 04:44.
Reply With Quote
  #24  
Old 29 Oct 2005, 05:29
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
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.
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #25  
Old 29 Oct 2005, 05:42
rookiyong rookiyong is offline
 
Join Date: Apr 2005
Great! Thanks, and I will still have use for your hack.
Reply With Quote
  #26  
Old 04 Nov 2005, 13:49
CyberRanger's Avatar
CyberRanger CyberRanger is offline
 
Join Date: Mar 2004
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!
Reply With Quote
  #27  
Old 04 Nov 2005, 16:10
mindfrost82 mindfrost82 is offline
 
Join Date: Feb 2002
I know that Brinnie is banned, but if anyone else is having a problem like her's, make sure that


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

is case sensitive. I kept it at 'yes' when my option was 'Yes' and it wouldn't work.

I think Amy said that somewhere in here too.
Reply With Quote
  #28  
Old 08 Nov 2005, 20:36
lazyseller lazyseller is offline
 
Join Date: Oct 2003
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
Reply With Quote
  #29  
Old 08 Nov 2005, 20:40
amykhar's Avatar
amykhar amykhar is offline
 
Join Date: Oct 2001
Real name: Amy
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
__________________
amykhar.com
----------------------------------------
I do not respond to PM requests for coding assistance.
Reply With Quote
  #30  
Old 08 Nov 2005, 21:01
silly rabbit silly rabbit is offline
 
Join Date: Oct 2005
Real name: Kiera
Originally Posted by amykhar
Not going to get a response from that user. She was banned.
Good Move!! amykhar, this is very cool - I like it, am convinced it will work and will use it but haven't installed it yet.

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
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 23:49.

Layout Options | Width: Wide Color: