View Full Version : HOW DO I automatically add someone to a Usergroup based on a Profile field?
ataraxia
12-05-2004, 02:43 PM
HOW DO I automatically add someone to a Usergroup based on a Profile field?
For example, if I have a single choice Profile field for, say, "Gender" with possible responses of "Male", "Female" and "Other", is there some way they could automatically be added as an "additional" member to my corresponding "male", "female" or "other" usergroup?
(A 2nd, related question is how do I update my existing users based in this?)
Thanks
amykhar
12-07-2004, 02:57 PM
bump
Do you mean at registration?
ataraxia
12-07-2004, 02:59 PM
Do you mean at registration?
Yes
(Plus I also need to update all of my exisiting userrs, as well.)
amykhar
12-07-2004, 03:40 PM
Yes
(Plus I also need to update all of my exisiting userrs, as well.)
If you require users to activate emails, the code you are looking for in register.php is here:
if ($userinfo['coppauser'] OR ($vboptions['moderatenewmembers'] AND !$userinfo['posts']))
{
// put user in moderated group
$user['usergroupid'] = 4;
}
if (empty($user['usergroupid']))
{
$user['usergroupid'] = 2; // sanity check
}
If you are going to change their primary group, simply add:
if ($userfield['field16']=='yes') // change this to suit you
{
$user['usergroupid'] = 12; // change this to suit you.
}
If you want to add them to a secondary group, the code will be different, but it will go in the same area.
ataraxia
12-07-2004, 04:01 PM
if ($userfield['field16']=='yes') // change this to suit you
{
$user['usergroupid'] = 12; // change this to suit you.
}
Thanks, Amy
This looks close but I need to add the user to an "additional" usergroup, not as a primary one.
What code would you use to add a user to an additional (secondary) group. (the user may also belong to several other additional groups.)
Thanks
error_22
12-29-2004, 12:54 PM
This is great, I rellay needed this, but there semms to be a problem....It simply doesn't work. Any ideas amykhar?
error_22
12-30-2004, 06:48 PM
anyone?
steven s
01-07-2005, 12:27 AM
Funny, I searched for the exact subject as I need something like this too.
My variation would be if my exttra profile field is a number from 1 to 6 digits or starts with an M or A or LIFE plus 1-6 digits they are placed in their own usergroup which can be a primary group.
error_22
02-22-2005, 06:19 AM
bump
mustang_lex
03-08-2006, 02:42 PM
"other" ?????
hiiped
03-08-2006, 04:02 PM
"other" ?????
https://vborg.vbsupport.ru/showthread.php?s=&threadid=82993
[vB 3.5.0 Beta 1] Add User to Secondary Usergroup Based on the Value of a Custom Profile Field at Reg.
https://vborg.vbsupport.ru/showthread.php?s=&threadid=82992
[vB 3.5.0 Beta 1] Add User to Primary Usergroup Based on Value of Custom Profile Field
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.