Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Add User to Secondary Usergroup Based on the Value of a Custom Profile Field at Reg. Details »»
Add User to Secondary Usergroup Based on the Value of a Custom Profile Field at Reg.
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: (3 votes - 4.67 average) Installs: 55
Released: 13 Jun 2005 Last Update: 13 Jun 2005 Downloads: 181
Not Supported Uses Plugins  

This version is for the SECONDARY group. The one for primary groups is here:

http://www.vbulletin.org/forum/showthread.php?t=82992

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 secondary user group based on that selection.

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 you are checking field10 instead of field5, change all references of field5 to field10.

Example: if you are checking your field to see if the value is male, you would change (change field number as needed):


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.

And in this line as well,

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

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.
----------------
Example Gender Mod that separates users into secondary groups based on their gender. Don't forget, the values are case sensitive and the field numbers and usergroup numbers need to be changed to suit your site's setup.


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

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 Primary Usergroup Based on Value of Custom Profile Field amykhar vBulletin 3.5 Add-ons 129 22 Dec 2013 17:06

  #121  
Old 26 Apr 2009, 05:12
Mum Mum is offline
 
Join Date: Jun 2006
Real name: Kirsty
Any way to make this happen any time they change fields, not just on registration?
__________________
Mummybrain.com We're virtually family
Reply With Quote
  #122  
Old 31 Dec 2009, 09:46
GHC Webmaster GHC Webmaster is offline
 
Join Date: Aug 2008
I'm trying to get this mod to work on VB4.0 but it does not seem to work anymore. Would you be willing to modify the mod for vb4?

The relevant hook is still there I noticed. I especially need the gender example you posted in your original post.

Thanks in advance!

Regards,

Walrick
Reply With Quote
  #123  
Old 09 Apr 2010, 20:54
Artes_Marciales Artes_Marciales is offline
 
Join Date: Jun 2007
Originally Posted by Bellinis View Post
Dear amykhar & others,

I'd been looking for such mod for a long time. Will this one still work for 3.8? I'm affraid not....
Is there an updated version of some similar mod?

Thanks a lot in advance!
Same here.. I am in need of this hack.
Reply With Quote
  #124  
Old 08 May 2010, 05:38
coffee's Avatar
coffee coffee is offline
 
Join Date: Oct 2002
Installed on vBulletin 4.0.3 PL1 and is perfect !
__________________
-
Reply With Quote
  #125  
Old 04 Jan 2011, 20:29
bulldog51981's Avatar
bulldog51981 bulldog51981 is offline
 
Join Date: Oct 2010
I had this mod working perfect until we updated to 4.1, I would be willing to donate if this could be updated please! I use it for the gender example and it was working great!
Reply With Quote
  #126  
Old 11 Jan 2011, 05:24
Stormlilly's Avatar
Stormlilly Stormlilly is offline
 
Join Date: Jan 2007
I have a need for this too Would be great if it could be updated.
Reply With Quote
  #127  
Old 08 Feb 2012, 13:13
RebelliousKrimp RebelliousKrimp is offline
 
Join Date: Dec 2008
I would also love an update on this mod, if you would be so kind.

Tagged for now, I eagerly await your (hopeful) enthusiasm to rework it! =D
Reply With Quote
  #128  
Old 03 Apr 2012, 22:07
temsamane temsamane is offline
 
Join Date: Sep 2010
i need this mod for vb4
__________________
Temsamane
Reply With Quote
  #129  
Old 10 Apr 2012, 03:08
Tyran1 Tyran1 is offline
 
Join Date: Jan 2007
Location: Deutsches Reich
need a fix for 3.8.7 please!!!!!
Reply With Quote
  #130  
Old 23 Apr 2012, 12:44
mavherzog's Avatar
mavherzog mavherzog is offline
 
Join Date: Dec 2004
Real name: Larry Herzog Jr.
Originally Posted by temsamane View Post
i need this mod for vb4
Ditto!!
Reply With Quote
  #131  
Old 14 Aug 2012, 15:55
Rebecca217 Rebecca217 is offline
 
Join Date: May 2002
Same here. Would be willing to donate.
Reply With Quote
  #132  
Old 07 Sep 2012, 12:35
imported_FreDy imported_FreDy is offline
 
Join Date: Dec 2004
I need this mod for vB4 too... I would pay for it
Reply With Quote
  #133  
Old 22 Sep 2012, 21:39
Ramsesx's Avatar
Ramsesx Ramsesx is offline
 
Join Date: Aug 2005
Location: Southern Germany
It shouldn't be too hard to get this running, it's just a simple sql query more or less.
Couldn't one of the coders here give a hint?
Reply With Quote
  #134  
Old 01 Jan 2013, 15:06
BenniX12 BenniX12 is offline
 
Join Date: Dec 2012
Hi!

I figured out how to modify the code. The code works fine when it is inserted after line 1507. This is just behind the hook "($hook = vBulletinHook::fetch_hook('register_activate_process')) ? eval($hook) : false;"

The code is:
// Get the value for field 5
$user = $db->query_first("SELECT field5 FROM " . TABLE_PREFIX . "userfield WHERE userid = $userinfo[userid]");

if ($user['field5'] == 'Test')
{
$membergroupids = $userdata->fetch_field('membergroupids');
if ($membergroupids)
{
$membergroupids = 9;
}
else
{
$membergroupids = 9;
}
$userdata->set('membergroupids', $membergroupids);
}

My prob is, that it does not work when I use it as a plugin. Could anybody help?

I guess .... but it did'nt work

<?xml version="1.0" encoding="ISO-8859-1"?>

<plugins>
<plugin active="1" product="vbulletin">
<title>Put User in Secondary Group Based on Custom Profile 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'] == 'Mathebuch')
{
$membergroupids = $userdata->fetch_field('membergroupids');
if ($membergroupids)
{
$membergroupids = 9;
}
else
{
$membergroupids = 9;
}
$userdata->set('membergroupids', $membergroupids);
$userdata->save();
}]]></phpcode>
</plugin>
</plugins>
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 22:24.

Layout Options | Width: Wide Color: