PDA

View Full Version : Allow user to choose usergroup at registration


rrr
01-26-2005, 12:37 AM
I thought I found the thread on how to do this at vbulletin.com, but it seemed to be missing the final step. I just found out that the reason it was missing the final step was that the standard vbulletin doesn't have a feature like this:

I'd like for my forums to have 2 usergroups (like 'buyers' and 'sellers').

At the registration point, I know I can add a new required field that asks if the person is a seller.

What I don't know is how to take that information (seller = yes) and have it automatically add that user to the 'seller' usergroup.

I'm hoping to have it as automated as possible.

Does a hack like this already exist?

Andreas
01-26-2005, 12:42 AM
I did that on my board, but this is pretty custom as it depends on the profile field you are using, etc.
If you can post more information (eg. field number, gorup ids, etc.) I could tell you which changes would be necessary.

rrr
01-26-2005, 01:39 AM
Thanks for the help:

I have the custom field in 'field5' as a 'Single-Selection Radio Buttons'. The user can select "yes I am a seller" or "no I'm not a seller".

If they are a seller, they should go in usergroup id9. Otherwise, they should be put in usergroup id10 (or I guess they could be in the default "Registered Users" group id2 if putting them in id10 is too difficult).

If you need any other information, just let me know.

Andreas
01-26-2005, 01:42 AM
So you want to change their primary usergroup or have 9/10 as an additional usergroup?

rrr
01-26-2005, 04:40 AM
Hmm...I didn't think of that.

I guess I want them all to be "registered users" (the primary usergroup). On top of that, I want them to have 9/10 as an additional usergroup.

I didn't know I could do that.

jzewatsky
01-27-2005, 01:57 AM
I've too have been looking for a mod like this for a while. I'd like mine to allow users to select a usergroup from a dropdown menu at the time of registration based on an answer to a custom profile field.

Andreas
01-27-2005, 02:27 AM
@rrr
In register.php FIND

$DB_site->query("
INSERT INTO " . TABLE_PREFIX . "user


ABOVE that ADD

switch ($_POST['field5']) {
case '1': $secgroup = 9;
break;
case '2': $secgroup = 10;
break;
}


FIND

reputationlevelid, reputation, autosubscribe, birthday, birthday_search)


REPLACE that with

reputationlevelid, reputation, autosubscribe, birthday, birthday_search, membergroupids)


FIND

'$birthday_search'


REPLACE that with

'$birthday_search', '$secgroup'

rrr
01-27-2005, 02:41 AM
Thanks! I'm going to give this a try now.

One thing:

switch ($_POST['field5']) {
case 'yes I am a seller': $secgroup = 9;
break;
case "no I'm not a seller": $secgroup = 10;
break;
}

in the "case" area, the part in between the single quotes should match what I have in the Admin Cp > User Profile Field > Options exactly, correct? With spaces, hyphens, CaSe SENstivity or whatever?

Andreas
01-27-2005, 02:44 AM
Yes. I know that it is a bit of pain, but this is how vBulletin stores the data ;)
That's the reason why I used double quotes for the 2nd one - there is a single quote inside.

rrr
01-27-2005, 05:01 AM
Thanks, that worked perfectly :)

jzewatsky
01-27-2005, 10:16 PM
but it does not seem to be working for me. I've edited register.php as noted, changed the information in the code to match my needs (profile field 17, with three options and three associated usergroups) but it does not seem to add the user to the user group...

vb ver 3.0.6

Any ideas?

Andreas
01-27-2005, 10:32 PM
What exactly is your field17?

jzewatsky
01-27-2005, 10:53 PM
A three option radio button question

mustang_lex
05-31-2005, 11:58 PM
I have a similiar dilema.

I need to have 2 different registrations.

One for group ID2 (registered members) in fact it can remain as is
The other however is a different registration for group ID9 (being my Stangette membership) and it required a photo upload.

Group ID2 can have a activation by email (normal) and Group ID9 NEEDS to be approved by an admin.. Can some one help

Thank You

reisser
06-16-2005, 06:34 PM
Hello,

ich just modified register.php for my vb.

The modification should check at first the e-mail adress and - at a second step - based on the result of the mail-check and a single-slection-radio-button, choose a usergroup.

Here it is...
I marked the modifications...

// assign user to group 3 if email needs verification
if ($vboptions['verifyemail'])
{
$newusergroupid = 3;
}
else
{
// ##############################
if ($vboptions['test_onoff'])
{

$mail = strstr($_POST['email'], ".");
$mail2 = stristr($mail, "@");

if ( $_POST['field5'] == Studenten AND $mail2 == false )
{ $newusergroupid = 11; }
else { $newusergroupid = 4; }

if ( $_POST['field5'] == Professoren AND $mail2 == true )
{ $newusergroupid = 9; }
else { $newusergroupid = 4; }

if ( $_POST['field5'] == Lehrbeauftragte AND $mail2 == true )
{ $newusergroupid = 10; }
else { $newusergroupid = 4; }

if ( $_POST['field5'] == Keine_Zugeh?rigkeit ) { $newusergroupid = 4; }[/B]
}
// ###############################
else
{
if ($vboptions['moderatenewmembers'] OR $_POST['coppauser'])
{
$newusergroupid = 4;
}
else
{
$newusergroupid = 2;
}
}
}
- verifyemail is off
- test_onoff is on

Everytime I test the modification all users were put into group 4

Any ideas what is wrong?

groeken

T3MEDIA
06-16-2005, 10:11 PM
Is there a hack that allows people to upload a photo when they register?
That would be nice.

Andreas
06-16-2005, 10:12 PM
They can upload a photo after registering and activating their account.

reisser
06-17-2005, 06:14 AM
@KirbyDE
Do you have any idea for my problem?