vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   HOW DO I automatically add someone to a Usergroup based on a Profile field? (https://vborg.vbsupport.ru/showthread.php?t=72520)

ataraxia 12-05-2004 02:43 PM

HOW DO I automatically add someone to a Usergroup based on a Profile field?
 
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

Quote:

Originally Posted by ataraxia
bump

Do you mean at registration?

ataraxia 12-07-2004 02:59 PM

Quote:

Originally Posted by amykhar
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

Quote:

Originally Posted by ataraxia
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:

Code:


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

  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

Code:

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" ?????


All times are GMT. The time now is 08:31 AM.

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.01054 seconds
  • Memory Usage 1,736KB
  • 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
  • (3)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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