vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Add User to Secondary Usergroup Based on the Value of a Custom Profile Field at Reg. (https://vborg.vbsupport.ru/showthread.php?t=82993)

Sadie Frost 10-06-2005 03:26 AM

Okay I tried doing this with your gender code, and I get sort of a weird result. This is what I have:

Code:

// Get the value for field 20
    $gender = $vbulletin->db->query_first("SELECT * FROM userfield WHERE userid=".$vbulletin->userinfo['userid']);


                if ($gender['field6'] == 'M')
                {
                        $membergroupids = $userdata->fetch_field('membergroupids');
                        if ($membergroupids)
                        {
                                $membergroupids = $membergroupids . ", 30";
                        }
                        else
                        {
                                $membergroupids = 30;
                        }

                        $userdata->set('membergroupids', $membergroupids);               
                }
                else
                {
                        $membergroupids = $userdata->fetch_field('membergroupids');
                        if ($membergroupids)
                        {
                                $membergroupids = $membergroupids . ", 31";
                        }
                        else
                        {
                                $membergroupids = 31;
                        }

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

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 10-07-2005 03:46 PM

Quote:

Originally Posted by amykhar
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 10-12-2005 08:37 PM

Quote:

Originally Posted by sensimilla
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 10-14-2005 11:27 AM

Quote:

Originally Posted by GamerzWorld
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 10-14-2005 01:06 PM

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 10-16-2005 03:37 PM

Ok i give up, hehe

jdh 10-23-2005 02:30 PM

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 10-29-2005 04:41 AM

You might want to check if the user is already in that group.

banjolawyer 01-08-2006 04:53 PM

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 02-19-2006 11:59 PM

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.


All times are GMT. The time now is 12:08 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01225 seconds
  • Memory Usage 1,750KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete