PDA

View Full Version : Add User to Secondary Usergroup Based on the Value of a Custom Profile Field at Reg.


amykhar
13 Jun 2005, 04:25
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.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



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):



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



to:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



And, finally, change the usergroup as appropriate. Instead of 10 in this line:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



substiture your usergroupid of choice.

And in this line as well,


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



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.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Amy

djr
13 Jun 2005, 06:19
Ooooooooooooh! This is so great. I'm not running vB3.5 yet, so if you could make this for vB 3.07??? Please Amy? :D (begging). If there's already a hack, I'd be much obliged with a pointer.

Cyricx
14 Jul 2005, 15:29
Would it be possible to use this code to check their and thereby age?

Like I have an 18+ forum that I use a secondary usergroup to control access to.

amykhar
14 Jul 2005, 15:33
Would it be possible to use this code to check their and thereby age?

Like I have an 18+ forum that I use a secondary usergroup to control access to.
Yes, you could use this basic structure. It wouldn't check the value of the userfield. It would do the math on their age.

Amy

merk
14 Jul 2005, 23:23
It would be nice if you could also hook the usercp pages so if they change an option the usergroups that were assigned at registration would also change.

Other than that, nice plugin :)

Brinnie
15 Jul 2005, 02:07
Hello,

Would you be so kind as to give an example of how this mod might be used? I am looking to do something with my usergroups (see attachment) but I don't know if I need this mod or the primary group mod.

Thanks a million. :)

Brinnie

Brinnie
15 Jul 2005, 02:09
It would be nice if you could also hook the usercp pages so if they change an option the usergroups that were assigned at registration would also change.

Other than that, nice plugin :)

That's what I was just wondering.
If I install this, would my members be able to cross party lines?

amykhar
15 Jul 2005, 02:11
It would be nice if you could also hook the usercp pages so if they change an option the usergroups that were assigned at registration would also change.

Other than that, nice plugin :)

I'll see what I can do.

Amy

Brinnie
15 Jul 2005, 02:51
no love 4 my question? :(

Chris M
15 Jul 2005, 02:59
no love 4 my question? :(

You asked it in the wrong place - Ask it in the "vBulletin Modification Questions" forum for vB 3.5.0 or the "General Modification Discussion" for 3.0.x depending on which forum you want it to run on ;)

Satan

Brinnie
15 Jul 2005, 03:06
You asked it in the wrong place - Ask it in the "vBulletin Modification Questions" forum for vB 3.5.0 or 3.0.x depending on which forum you want it to run on ;)

Satan

oh ok. I'm a n00b, I don't know these things.

Do I need to entitle it: " Add User to Secondary Usergroup Based on the Value of a Custom Profile Field at Reg."?

Chris M
15 Jul 2005, 03:10
oh ok. I'm a n00b, I don't know these things.

Do I need to entitle it: " Add User to Secondary Usergroup Based on the Value of a Custom Profile Field at Reg."?
No - Reeve of Shinra has provided one way of doing it, here (http://www.vbulletin.com/forum/showpost.php?p=916350&postcount=8)

If you decide to do it that way, you will only require the use of one of the hacks by amy :)

If you decide to do it via custom code, you will need to ask ;)

Satan

Brinnie
15 Jul 2005, 03:35
No - Reeve of Shinra has provided one way of doing it, here (http://www.vbulletin.com/forum/showpost.php?p=916350&postcount=8)

If you decide to do it that way, you will only require the use of one of the hacks by amy :)

If you decide to do it via custom code, you will need to ask ;)

Satan

Do you know which one of these hacks would be better?

Chris M
15 Jul 2005, 03:37
Do you know which one of these hacks would be better?

It depends whether you want the user to be moved into a different Primary Group or added to a Secondary Group :)

Satan

Psionic Vision
01 Aug 2005, 21:14
Nice hack. A few suggestions:

1. Make it configurable from admincp.
2. Replace



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



With



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

amykhar
01 Aug 2005, 21:15
1. Yes, that can be done now. When I wrote this, changes to the admincp required code edits, which I was trying to avoid.
2. I realize your way is shorter, but when I write code for here, I prefer to break things out to make it as simple to read as possible. That way, new coders get a glimpse at what is going on.

thecool
18 Aug 2005, 23:18
Is there anyway to have the user added as a primary user of the Customer field as opposed to a secondary user?

thanks

Andreas
18 Aug 2005, 23:19
Did you know that vBulletin has a nice search function? ;)
http://www.vbulletin.org/forum/showthread.php?t=82992

thecool
18 Aug 2005, 23:44
Did you know that vBulletin has a nice search function? ;)
http://www.vbulletin.org/forum/showthread.php?t=82992

Didn't read it up top, browsed it and missed, thanks for the heads up.

Bad Bunny
02 Oct 2005, 07:25
Is this working for gold? Cause I can't seem to get it to work. I have field5 and Yes (is it dependent on caps?) adds to group 11. Which is pretty simple...since it's almost default.

Sovereign
02 Oct 2005, 19:54
Yay, this will work for ranksets, assigns users to rank groups (for custom rankings like Army, Star Wars etc.) Now for one without email validation...

amykhar
03 Oct 2005, 17:54
It's case sensitive and it's working on my gold site.

PennylessZ28
04 Oct 2005, 01:06
What would the use of this system be? Could I use this to say put Females in a Female Usergroup and Male in a Male group and then search for a user by sex? if that was the usergroup?

amykhar
04 Oct 2005, 03:55
I have a private forum for women and one for men. This gives my users access to those groups. You could use it for whatever floats your boat though - not just gender. You could check to see if people like peas or not. Or, you could sort people into clans at registration time. Whatever your little heart desires and is capable of coding ;)

PennylessZ28
04 Oct 2005, 04:13
Good deal, I didn't think about gender related forums. I am working on something and you just gave me an awesome idea. Thanks bro!

sensimilla
04 Oct 2005, 06:43
so it can work with only one choice..?

what if I want "male" "female" "couple" to create 3 different usergrups?

TIA

GamerzWorld
04 Oct 2005, 08:50
This hack is great what ive been looking for, however have a question. Currently i have two clans running on my board, both require validation before you get moved into the secondary usergroup. Will this hack automatically bypass this or simply add them into the que, and if it does bypass is there anyway i can make it so it simply adds them for auth by the group admin

amykhar
04 Oct 2005, 20:28
It bypasses it as written. It wouldn't be a major deal to add them to the queue instead.

Sadie Frost
06 Oct 2005, 02:49
Not working for me in RC3 - would image verification interfere with this or anything?

amykhar
06 Oct 2005, 03:35
No and it's still working on my site which has used every version up to and including gold. Check any edits you made to the plugins and ensure the fields and cases are correct.

Sadie Frost
06 Oct 2005, 04:26
Okay I tried doing this with your gender code, and I get sort of a weird result. This is what I have:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



So my gender field is field 6, and my choices at M or F. So I made a test user with the M setting, and it put them in usergroup 31. So unless I'm reading that wrong, that's the wrong one. Am I just totally missing something here? Any help would be appreciated :)

GamerzWorld
07 Oct 2005, 16:46
It bypasses it as written. It wouldn't be a major deal to add them to the queue instead.
How would i do that? Many users cant find the group membership page so as i said this would be great if they could select which clan they were in and be automatically joined to que for validation

scottblumin
12 Oct 2005, 21:37
so it can work with only one choice..?

what if I want "male" "female" "couple" to create 3 different usergrups?

TIA


Did anyone answer this question - I have the same question. I have four usergroups based on Geography.

Thanks.

GamerzWorld
14 Oct 2005, 12:27
How would i do that? Many users cant find the group membership page so as i said this would be great if they could select which clan they were in and be automatically joined to que for validation

Any guidance :)

GrendelKhan{TSU
14 Oct 2005, 14:06
you know...before this thread...
I didn't even really get what one needed secondary user groups for. so thanks!!

now I can take that OFF my list of things to learn, and put it ON my list of things to install. :P

<<< runs in n00b shame :)

cool stuff...will be installed when I get that far. :D

GamerzWorld
16 Oct 2005, 16:37
Ok i give up, hehe

jdh
23 Oct 2005, 15:30
On thing that's really been missing in vBulletin IMHO is group-centric management (ie, select a group and then add/remove users). However, this plug-in looks like it might help me...

In my particular case, I run a private board for a youth organization with some forums that are only accessible by users in a certain training level, and other forums that are only accessible by users in a certain team. Both of these groupings are a reflection of their level and membership within the organization, as opposed to the board itself.

Normally, the level changes each year (assuming they pass), and the team membership can change fairly regularly as well.

Traditionally, I have used secondary groups for this, but as I mentioned above, that's a pain to maintain (since I can't just select the "Level 1" group and add fifteen members... Rather, I have to select each of the fifteen members manually and add them to the "Level 1" group as a secondary group).

However, the use of a custom profile field to control their membership would greatly simplify this for me, since not only would it control the group membership easily, but it would also allow me to import this information from an existing database (since I do already have it stored in a membership database).

There would be a couple of things that I would need to consider...

Firstly, I would need it to hook into somewhere else other than user registration, since the profile fields will change from time to time for existing users. I'm thinking of a hook into forumhome_start or somewhere related to login. This particular board only has about 200 users, so I'm not overly concerned about performance issues (although I'd like to avoid any glaring one). Any thoughts on a more suitable hook for this purpose?

The second problem, which is a more complex one, would be have it remove any groups for which the user is no longer. In other words, if the user is now in Level 2, they should be removed from the Level 1 group (or, put more simply, I guess they could be removed from ALL level groups and then re-added to the one that matches their profile field). The same would need to occur for the team groups (they can only be a member of one team at a time).

Any thoughts or advice on how to accomplish this would be very helpful. I don't consider myself a novice in programming, but I would like to benefit from the advice of those more experienced in working with vBulletin (especially the new 3.5 hooks system) before I attempt any of this myself...

Code Monkey
29 Oct 2005, 05:41
You might want to check if the user is already in that group.

banjolawyer
08 Jan 2006, 17:53
Would this plugin work for adding a user to more than one secondary usergroup? For example if I added a "multiple selection checkbox" custom profile field, could it add the user to 2 or 3 differnt public usergroups if the user checks 2 or 3 checkboxes?

DaveAK
20 Feb 2006, 00:59
Any one got this working when you don't have email verification? I tried using the "register_addmember_complete" hook, but this didn't work. I'm not a complete novice to PHP, but I am when it comes to vBulletin. I understand the purpose of the hooks, but I can't seem to figure out which one I need to use.

paulfletcher
13 Mar 2006, 02:54
Does this still work if I'm using CMPS on my board? Do I have to change the "Product" option in vbulletin from "vBulletin" to "CMPS" when I'm installing this?

paulfletcher
14 Mar 2006, 01:49
Anyone :-)...? So alone...

amykhar
14 Mar 2006, 02:02
Why wouldn't it and why would you? :confused:

paulfletcher
15 Mar 2006, 03:30
lol. I don't know. I'm new to vBulletin, and so far. When I've tried installing this script it still doesn't work. I've made sure my text field during registration is not hidden, and that it is field5, and that its upgrading to the correct usergroup ID. (just like your script). And I've tried typing in the correct information so my account can be upgraded, although... Still no luck. The newly registered user is still not being upgraded.

So I was thinking that it was probably my stupidity that was preventing the script from being correctly installed.

Any thoughts?

Thanks,
Paul Fletcher

paulfletcher
15 Mar 2006, 15:49
Would you, are someone be willing to help me install this plugin and get it working. I'll get you an admin login for our forum.

Thanks,
Paul

paulfletcher
16 Mar 2006, 03:54
Alright. So, our site has to open on March 27th, and I'm clueless on how to make this script work. After installing the script... Everything the same (except groupID has been changed from 10 to 11.

I get this error when I activate my account.

Parse error: parse error, unexpected '<' in /homepages/9/d89699556/htdocs/xyztraining_com/register.php(930) : eval()'d code on line 1

When looking in the registration.php file on line 930 I see this...

$hook = vBulletinHook::fetch_hook('register_activate_process')) ? eval($hook) : false;

Does this help anyone figure out where my problem may be lying?

Thanks,
Paul

rnmcd
16 Mar 2006, 03:57
Would you, are someone be willing to help me install this plugin and get it working. I'll get you an admin login for our forum.

Thanks,
Paul
Maybe it doesn't work with your version of vBulletin(?).

paulfletcher
16 Mar 2006, 12:52
Thats what I originally though as well, but Amykhar told me that she has it working on vBulletin 3.5.4.

Wouldn't this error
Parse error: parse error, unexpected '<' in /homepages/9/d89699556/htdocs/xyztraining_com/register.php(930) : eval()'d code on line 1

suggest that there is an extra "<" somewhere in the script? Although I can't find it, and the ones that I do see I have no clue whether there actually supposed to be there. (I don't know PHP).

Any thoughts?

Thanks,
Paul

amykhar
16 Mar 2006, 14:48
paul, my software for work just went out the door and I have about half an hour of free time before I need to get back to work. PM me your admin info and I'll see what I can do for you.

paulfletcher
16 Mar 2006, 21:42
I sent the login credentials to you.

Thanks again,
Paul

paulfletcher
17 Mar 2006, 22:47
It's working Great! Thanks for your help.

-Paul

rnmcd
17 Mar 2006, 22:54
It's working Great! Thanks for your help.

-Paul
Did amykhar happen to mention what the problem was?

paulfletcher
17 Mar 2006, 23:11
Ah yes... Sorry.

She said that the variables were different after email activation (in the script... I think). Thats all I know :-) But the script is now doing everything we need on our site.

Thanks,
Paul Fletcher

Sculli
18 Mar 2006, 11:12
This plug is awesome.
I would like to use it to have a radio-button single selection going on where users can switch as the please.

How would I go about accomplishing that? Just a bunch of if statements checking which groupid needs to be removed before assigning a new one?

paulfletcher
19 Mar 2006, 04:22
Are you talking about adding the radio-buttons in the user CP, so a user is able to switch between categories and user-groups as they want?

Thanks,
Paul

Sculli
19 Mar 2006, 04:42
Yes that is exactly it. The user will have the choice between usergroupA, usergroupB, and usergroupC. The choice is made using radio buttons, so the user can only be a member of one of the groups at any given time. But the user can switch groups at will through the Edit Profile.

paulfletcher
19 Mar 2006, 15:03
I actually looked into doing something like that. Where our activation code text field would be able to be changed in the login / privacy area. Although for this to work you would have to change the hook. Probably from register_activate_process to when you login.

Although I don't know how to do this (modifying the original script), you could just try playing around with the hook settings. So every-time the user logs in, the script is activated to see what the value of that radio button is.

Thanks,
Paul

rnmcd
19 Mar 2006, 15:33
Yes that is exactly it. The user will have the choice between usergroupA, usergroupB, and usergroupC. The choice is made using radio buttons, so the user can only be a member of one of the groups at any given time. But the user can switch groups at will through the Edit Profile.

I was under the impression that is the way it is done presently.

Anyone happen to have this installed on a board that they could let me look at?

amykhar
19 Mar 2006, 16:14
The choice doesn't have to be radio buttons. A text field works as well. But, the choice can't be changed after the user registers. They would have to use the regular member group interface for that.

rnmcd
19 Mar 2006, 16:52
The choice doesn't have to be radio buttons. A text field works as well. But, the choice can't be changed after the user registers. They would have to use the regular member group interface for that.
Oh I get it now. The user can't change their usergroup by changing the respective profile field in the UserCP.

When you say, "They would have to use the regular member group interface for that." "They" are Admins, not members, right?

amykhar
19 Mar 2006, 18:01
No. I mean members. Members can leave public groups and ask to join public groups. Combine this with my mod that pms group leaders when users make a request, and you'll have a usable interface.

I don't need my members to change groups after registration becuase except in very rare cases, I don't think their gender is going to change ;)

Sculli
19 Mar 2006, 19:43
But, the choice can't be changed after the user registers. They would have to use the regular member group interface for that.You mean as it is coded now it can't be changed? There is no reason it couldn't be changed if it was coded differently though, right?

I run an online game related message board, and users can have one of three allegiances. Depending on which allegiance they currently have, they are assigned to a usergroup that then assigns them a rank image that shows their allegiance. However, users can change their allegiance in game, and I would like them to be able to change their allegiance choice as well.

I currently use simple publically joinable usergroups. The issue with that is that a user could join multiple groups and thus display multiple allegiance rank images. Some users do, and it's annoying to me to have to hunt them down and tell them that they are misusing the allegiance option.

If I were able to make the allegiance choice a radio button choice in the profile, then they could only have one allegiance at a time, but they would need to be able to change it when they change it in game.

There ought to be a faily simple way to do that. Something along the lines of:
-radio button choice indicates user wants to be part of group A
-check whether user is part of group B already, if so, remove user from group B
-check whether user is part of group C already, if so, remove user from group C
-add user to group A

Murty
11 Apr 2006, 04:49
a few months ago i was having trouble installing the "Put User in Secondary Group Based on Custom Profile Field Value" hack. Well i thought it was all sorted, but for some reason, users are still being put into any random fields(eg male or female). I have not edited any code or anything, but it has been an increasing issue (having to manually change users).

Has anyone got any thoughts?

Please help

Injektilo
26 Apr 2006, 09:38
amykhar or even someone else...please help me out here

i have a gender field with 3 options (male,female,secret) how can i set males to have one secondary usergroup, for females another, and for those who selected ecret to remain as it is (dont get a secondary usergroup)

amykhar
26 Apr 2006, 10:45
It's just ifs and elseifs to handle three groups.

sepulchres
02 May 2006, 09:47
Is it possible to use this function based on two custom fields instead of one? If so, how would the code differ to the one above? Cheers.

ronoxQ
24 May 2006, 01:05
You'd just add another field to the plugin that looks for a different field.

Amy, here's my modified profile code, but it doesn't add me under a secondary usergroup. Any ideas?



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

amykhar
24 May 2006, 12:37
ronoxQ, I'm going to respond via pm.

ThePiston
06 Jun 2006, 17:08
I've got a 5-option radio field that I can't get to work corectly.

I sort of got it to work, but with this code, it it puts new members into 2 Groups, whatever they chose and always the last Group (the else clause) listed as well (so 2 groups). Where am I going wrong?



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



*****EDIT**** I fixed it, I needed 'else if' and not 'if'

Shoebuddy
12 Jun 2006, 10:41
Can I write this code? or use a switch statement




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

futuredood
15 Jun 2006, 21:57
is their any way to make this a hack with a user interface?

amykhar
15 Jun 2006, 22:38
It's not the kind of mod that's really conducive for a user interface. It's one of those set it once and never touch it again kinds of things.

futuredood
16 Jun 2006, 03:38
hmm.. i'd like to have it so that people can select from the list. the thing is, if i have a list of five options, say A B C D E, and then I end up adding a 6th option and still wanted to maintain the ABC order, I'd place it between the A and the B. the problem with that is, users who selected B are now changed because the list changed by one line. any ideas?

patrickstar
28 Jun 2006, 01:58
ok this is what i did:
1. created new profile field: gender
2. value = 'M' or 'F'
3. created new usergroup: female
usergroup id: 10

i have made the neccesary changes to the xml file and now the silly question. how do i upload it to my plug in manager. i just save text and upload?

thanks and great hack.

paulfletcher
28 Jun 2006, 05:29
AdminCP > Plugin System > Plugin Manager > Add New Plugin


I think this is what your looking for.

Thanks,
Paul

paulfletcher
28 Jun 2006, 05:31
Oh, if you already have the plugin installed and you just want to make a code edit. Inside the Plugin Manager, click on the plugin you want to edit. Once the next page has loaded, located Plugin PHP Code... To the right of that is where you can edit your code.

Thanks,
Paul

patrickstar
28 Jun 2006, 09:38
AdminCP > Plugin System > Plugin Manager > Add New Plugin


I think this is what your looking for.

Thanks,
Paul

yea i found that but my question is, how do i download the xml file? its not allowing me the option to save it, it just opens up to the text.

amykhar
28 Jun 2006, 12:19
Right click - > 'Save As'

patrickstar
28 Jun 2006, 14:17
lol. that easy uh?

well i just wanted to make sure, i havent uploaded a plug in yet.

thanks again, this is a great hack, that i am going to use.

patrickstar
29 Jun 2006, 02:14
hello amy can you help me out. i thought i did everything right.

1. i added new usergroup = 10
2. i have gender field '7'
3. i have required email verification
4. i have gender required at time of registration
5. M or F

this is what i have as php code:
// Get the value for field 7
$user = $db->query_first("
SELECT field7
FROM " . TABLE_PREFIX . "userfield
WHERE userid = " . $vbulletin->userinfo['userid'] . "
");


if ($user['field7'] == 'F')
{
$membergroupids = $userdata->fetch_field('membergroupids');
if ($membergroupids)
{
$membergroupids = $membergroupids . ", 10";
}
else
{
$membergroupids = 10;
}

$userdata->set('membergroupids', $membergroupids); }

but when i enable the plug in, everything seems to go fine when registerring, but i get this message after following my registration link and logging in:

Your account has already been activated so please try logging in.

everytime i try to log in.

can you please help with any suggestions. thanks.

patrickstar
30 Jun 2006, 00:08
ok so basically i have the plug in enabled, i have email verification on and the code as above. i have registered usergroup permissions to the girls forum off and the custom permissions for the custom usergroup 'female' granted. will the registerred usergroup settings over ride the 'female' usergroup settings on this? and when i register as a female with the required field 'F', i do not see that as a secondary usergroup.

please help, even suggestions.

patrickstar
30 Jun 2006, 21:40
chirp

JenniferK
28 Aug 2006, 17:10
Quote:
Originally Posted by Cyricx
Would it be possible to use this code to check their and thereby age?

Like I have an 18+ forum that I use a secondary usergroup to control access to.

Quote:
Originally Posted by amykhar
Yes, you could use this basic structure. It wouldn't check the value of the userfield. It would do the math on their age.

Amy

Can I have a little help with how to do this exactly?

moonclamp
08 Sep 2006, 15:37
Can anyone tell me the SQL query I'd need to run if I wanted to add the relevent existing members to the secondary group too?

criscokid
16 Sep 2006, 11:16
Can anyone tell me the SQL query I'd need to run if I wanted to add the relevent existing members to the secondary group too?
Take a look at the mySQL commands - make user a secondary usergroup member thread (http://www.vbulletin.com/forum/showthread.php?t=200075).

moonclamp
16 Sep 2006, 11:47
Take a look at the mySQL commands - make user a secondary usergroup member thread (http://www.vbulletin.com/forum/showthread.php?t=200075).
Cheers :)

criscokid
17 Sep 2006, 11:16
How would I edit the XML file to add users to Usergroup ID 15 when Profile field16 = Male and Profile field17 = 1 or 2?

criscokid
18 Sep 2006, 19:20
Can anyone tell me the SQL query I'd need to run if I wanted to add the relevent existing members to the secondary group too?
Following on from my previous post elling you how to achieve this... I ran the two commands and now I all of the females are now members of the secondary group that I was setting. I assume this is beacuse the 'Male' appears in the word 'Female'?

Toopac
24 Sep 2006, 16:06
What would i need to do to get this working with email validation turned off?

I have not downloaded or installed anything yet.

Any help is most appreciated:cool:

wes_517
01 Dec 2006, 02:52
While trying to find something that will require moderation before giving access to the group, I saw a few people were interested, here's one version of code, it may not be pretty, but it works...

it also doesn't email out, but it does the job.

when they register, if field 23 is a hit, it adds them into the moderation table of the database.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I can do PHP, but efficiency isn't a strong point within VB yet for me, so if anyone would like to improve the code, feel free and I'd appreciate it.

the duplicate SQL string is me after a long day just trying to make sure that SOME sql happens if none of the cases are hit, it would probably be just as good to check the sql to see if there is a string...

Murty
10 Dec 2006, 23:18
Does anyone know if this will work for 3.6?

Woot for 200 posts :)

Mum
16 Jan 2007, 03:00
I was wanting it for 3.6 as well, any ideas anyone?

Murty
22 Jan 2007, 06:10
amykhar said that she has it working, so it should probly work.

FireFish
25 Jan 2007, 16:28
It would be nice to be able to allow multiple instances of this running for different user groups based on different values.

Mum
25 Jan 2007, 18:44
Not sure what i'm doing wrong, here is the code i'm using, it is field5 that i'm wanting, and 'Female' is what i'm looking for, to put into group 33, if they aren't Female, then group 2. What have i done wrong?



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

FireFish
26 Jan 2007, 21:40
Not sure what i'm doing wrong, here is the code i'm using, it is field5 that i'm wanting, and 'Female' is what i'm looking for, to put into group 33, if they aren't Female, then group 2. What have i done wrong?



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Here's your problem:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Should be:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


It knows to put others who enter anything but Female into 'Users Awaiting Confirmation'

JoeZ
17 Mar 2007, 17:35
How do I update the currently registered users for this? Where to I place the hook?

I'm using it as a gender mod.

FireFish
19 Mar 2007, 16:41
Good question: Here's what I did:

I made the new Profile Field for this mod as 'Private', which means once it is entered, the field doesn't show up to be editted by the user or shown.
However, the problem lies in the existing users.
What you do is run a SQL Statement to update the value of that field for all users to, say, 'none'.

This script only works for new registrations ongoing.
If a user adjusted the value of that field, it won't add them to your secondary group unless it was while they were registering.

You should make the default value 'none' & instruct your visitors to only fill in their 'Invitation Code' if they were given one.

Medina
12 Apr 2007, 20:37
I'm having a problem with this nice hack.

When NEW members on my forum register and choose from the custom-field (male or woman) they won't see at all the special corners that are made for male/woman members. This hack does work with existing members. Who could help me with this.

At the begin it worked fine, but now it seems their is a strange problem with it, i self think that it's at the hook location.

I would be thankfull.

Medina

MAXpowerPXL
16 Apr 2007, 08:38
Would this plugin work for adding a user to more than one secondary usergroup? For example if I added a "multiple selection checkbox" custom profile field, could it add the user to 2 or 3 differnt public usergroups if the user checks 2 or 3 checkboxes?

so it can work with only one choice..?

what if I want "male" "female" "couple" to create 3 different usergrups?

TIA

:confused: I am also wondering about this..

I have about 10 usergroups.. I would like to let users join one more (even all).

Medina
16 Apr 2007, 10:26
dear amy,

is this plugin also for 3.6 suitable?

Regards

Medina

asaeed
25 Apr 2007, 16:00
amy
i want to use your ads with out
require users to verify their email address upon registration
i dont use that in my fourm

Medina
20 May 2007, 16:10
can i please have a reply on my question :o

Murty
21 May 2007, 00:42
can i please have a reply on my question :o

Hey medina, i dont think you will be able to contact amy through this thread. you will probably have to send her a pm. But to save you the hassle, i have already PMed her and she said it works fine, but i have put it on and stuff around with it for ages and still havent go it to work. I now have someone making a whole new mod for me. Once hes finished it and ive tested it, i will let you know and you might be able to buy a copy from him if you really need it.

Hope that helps.

Medina
21 May 2007, 07:35
Hey medina, i dont think you will be able to contact amy through this thread. you will probably have to send her a pm. But to save you the hassle, i have already PMed her and she said it works fine, but i have put it on and stuff around with it for ages and still havent go it to work. I now have someone making a whole new mod for me. Once hes finished it and ive tested it, i will let you know and you might be able to buy a copy from him if you really need it.

Hope that helps.

Hello Murty,

Thank for your reply.

I'm two days busy with Amy's plugin, but i won't work on 3.6.5. I think that you first have to install vb 3.5. and install Amy's plugin and so you have to upgrade it to 3.6.

Is that maybe a option? Or am i talking bullshit. :D

Anyway if your new mod is all done Murty can you please response on this topic, so i can take a look to the new mod.

Thank you

Regard,

Medina

Murty
22 May 2007, 21:21
Yeah i stuffed around with it as well. To be honest the mod didnt really ever work for me properly on 3.5 anyways. I am still awaiting for my mod to be completed, but i will let you know when its done.

Murty
29 May 2007, 23:49
Hey guys,

For those of you interested, a guy has created a modification that will move users to a specified usergroup depending on a profile field selection.
For me, when a user registers, they need to select whether they are male or female. Once they have registered, depending on whether they selected male or female, they get moved to the male or female user group i created.

You are able to get this mod by sending an email to: hugh@alaweb.com and requesting the 'user profile group modification'.
This mod was not made for free, so it will cost you $25.00 US.

I have tested it with vb 3.6.5 and it works great, highly recommend!

PM me if you want more info.

ahmedeldeep
09 Jul 2007, 18:51
Thank you

groeken
22 Sep 2007, 20:57
Hello,
is anybody here using this mod on vb 3.6.8? Im not sure but on my site it wont work.

Mum
24 Sep 2007, 19:28
I am, and it's working fine :)

groeken
24 Sep 2007, 21:10
mhh.. then must be an error in my syntax, i think. Maybe anyone has an idea what is wrong..
the main problem is that if i had to activate more than 1 user at the same time the users will be put in the same group, allthough they had different choices for the selected field.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



any ideas?

groeken

dcw
15 Apr 2008, 05:51
Does this work for 3.7?

Ramsesx
20 Apr 2008, 09:07
Does this work for 3.7?
Yes it works for me on 3.7 RC1

Mum
16 May 2008, 00:58
Doesn't work for me on 3.7 gold, database error apon sign up.

MG Webmaster
09 Jun 2008, 22:12
So does it work on 3.7.1????

biome.pat
17 Sep 2008, 16:42
Hey folks! I've read through this whole thread, and can't seem to find anyone with the same problem (except maybe Murty in post #63). It seems that the plugin works for most registrations, but a few users end up in the wrong category. To explain, I've got it set up so field5 is a single-selection menu where members/students pick their year of study. I have it set up so that if they pick "Year 1" from the pull-down (instead of the other options of "Year 2", "Year 3", "Year 4+", "Grad Student" or "Alumni/Other"), they're put in a special usergroup with different forum access (called "Year - 1"), while if they pick anything else, they're put in another usergroup (called "Year - Other").

Settings are like so:

Set Default: Yes, Including a First Blank
Field Required: Yes, at Registration and Profile Updating
Field Editable by User: Only at Registration
Private Field: No
Field Searchable on Members List: Yes
Show on Members List: Yes

Every few days, I've been doing a search for students who have both "Year 1" chosen in the profile field, and are in "Year - Other" usergroup. If I'd set this up correctly, there shouldn't be any users found, but there are always a few.

Any ideas? It might be important to mention that the board has a high registration volume at the beginning of the academic year, so we've had over 1000 new users in 48 days.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Any insight would be muchly appreciated!

biome.pat
17 Sep 2008, 18:10
Alright, so after doing 30 or so registrations is different browsers (and changing "Set Default" to "No", so that each registrant has so select the menu and choose an option (as opposed to first year's just seeing it already selected and leaving it), it seems it's an IE issues. After I changes the "Set Default" option, firefox never seems to have any problems (an it did once or twice before), but IE never puts them in the right category. They automatically end up in the usergroup indicated by the else statement (id:14 or "Year - Other"). Any ideas here folks? I'm baffled!

Levo1980
30 Dec 2008, 16:30
sorry my english ist not the best
i have import the xml and befor i import this i have changed this like this:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



But it doenst work....
I use VB 3.6.6 and on fild8 they have to select männlich or weiblich (male or female), i want that all "weiblich" go to the secondary usergroup ladies which have the the ID:10.

Can somebody help me???

Bellinis
26 Feb 2009, 10:55
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!

sensimilla
07 Apr 2009, 15:22
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.

Mum
26 Apr 2009, 04:12
Any way to make this happen any time they change fields, not just on registration?

GHC Webmaster
31 Dec 2009, 08:46
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