Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
AUTOJOIN - Auto-entry in membergroup via field in profile Details »»
AUTOJOIN - Auto-entry in membergroup via field in profile
Version: 1.05, by makaiguy makaiguy is offline
Developer Last Online: Oct 2016 Show Printable Version Email this Page

Version: 3.5.4 Rating:
Released: 03-31-2006 Last Update: 06-05-2006 Installs: 18
Uses Plugins
Re-useable Code Translations  
No support by the author.

Here's a little something to give back to this community that has been of such help to me.

With this plugin, you can have a user entered into or removed from a secondary usergroup according to several types of controls that can be placed in the user's profile via custom fields. This acts only on SECONDARY usergroups and will not affect the user's PRIMARY usergroup.

At each login, the plugin will check for the appropriate setting in the user's profile, then add or remove the user from the specified membergroup as appropriate. Note that this does not act instantaneously upon entry of the data in the profile, but requires a new login for this to take effect. [Starting with vB 3.6.4 (maybe earlier, I didn't install anything between 3.5.4 and 3.6.4) this will take effect with one or two page reloads.]

Controls currently available:
1) Password for single usergroup
2) Yes/No choice for single usergroup via radio button
3) Choose one of several usergroups via radio buttons
4) Choose any of several usergroups via multiple checkboxes
Note that you may write your own additional controls and use the two included functions to do the actual insertion into, and removal from, the target usergroups.

Tested with vB 3.5.4, 3.6.4, 3.6.7-PL1, 3.8.7PL3 only.

Full instructions are in the downloadable text file autojoin.txt.

Update log:
  • 1.00 - Initial release
  • 1.01 - Sorts output membergroups numerically plus a few other small changes
  • 1.02 - Rewritten using defined functions for adding to, and removing from, memberbgroups. This should make it easier to follow the logic and to adapt the code for other situations (e.g.checkboxes or radio buttons instead of text profile fields)
  • 1.03 - InGroup() and OutGroup() functions rewritten to make them more useful when dealing with other situations than the somewhat restricted application of entry/exit of specific membergroup via stored password.
  • 1.03.1 - Additional tweaking of InGroup() and OutGroup() functions. Tested extensively and seem to be working as intended. Tested examples of using via radio buttons instead of text field added.
  • 1.04 - Added protection against doing anything re user's current PRIMARY usergroup in secondary usergroup list. Functions renamed to IntoGroup() and OutOfGroup().
  • 19 April 2006 - all code moved from this thread into the downloadable text file.
  • 1.05 - Added control for using multiple checkboxes to choose any of several usergroups.
  • 22 May 2007 - tested with vB 3.6.7-PL1
  • 24 Sep 2012 - tested with vB 3.8.7-PL3

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #42  
Old 06-06-2006, 03:29 AM
makaiguy's Avatar
makaiguy makaiguy is offline
 
Join Date: May 2004
Location: Aiken, SC, USA
Posts: 150
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Amazing. It worked right out of the box with no debugging at all. Must have held my mouth just right while coding, or something. Anyhow, here's what to use as the control in place of the ones in the downloadable autojoin.txt file:
PHP Code:
// Add or remove user from secondary usergroup
// according checkboxes selected in user's profile
// Ver 1.4

global $vbulletin;

// Enter values in the strings below for your forum
  // number of the custom field containing your checkboxes
        
$boxes_field 'fieldX';
  
// Usergroup number for FIRST checkbox option
        
$ug[0] = 'X';                     
  
// Usergroup number for SECOND checkbox option 
        
$ug[1] = 'Y';                     
  
// add additional checkbox options as needed 

// You need make no changes below here
                         
// Derive additional needed variables
  // userid of user
        
$userid = ($vbulletin->userinfo['userid']);                           
  
// current usergroups as array
        
$ugarr explode(',' , (''.$vbulletin->userinfo['membergroupids']));  
  
// boxes selected
        
if ($vbulletin->userinfo[$boxes_field] == '')
        {
           
$fieldval 0;
        }   
        else
        {
           
$fieldval $vbulletin->userinfo[$boxes_field];
        } 

// Do the work
$iii 0;
foreach (
$ug as $value
{
   if (
$fieldval pow(2$iii))
   {
      
$ugarr IntoGroup($ugarr$ug[$iii], $userid);
   } 
   else
   {
      
$ugarr OutOfGroup($ugarr$ug[$iii], $userid);      
   } 
   
$iii++; 

.. then just add in the code for the two functions as in the downloaded autojoin.txt file.

I'll get this added to the autojoin.txt file real soon now ...

[Edit:] Has now been added to the downloadable autojoin.txt file, as version 1.05.
Reply With Quote
  #43  
Old 08-26-2006, 04:01 PM
cavyspirit cavyspirit is offline
 
Join Date: Jan 2004
Posts: 151
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I really need this in 3.6. First attempt isn't working.
Reply With Quote
  #44  
Old 08-31-2006, 10:03 PM
makaiguy's Avatar
makaiguy makaiguy is offline
 
Join Date: May 2004
Location: Aiken, SC, USA
Posts: 150
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cavyspirit
I really need this in 3.6. First attempt isn't working.
I haven't updated my board to 3.6 yet. But since this hack is very important to my board's operation, you can be sure I'll be updating it to work with 3.6 in the near future.
Reply With Quote
  #45  
Old 11-12-2006, 10:29 PM
cavyspirit cavyspirit is offline
 
Join Date: Jan 2004
Posts: 151
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I now need to make this work on the regular Birthday field.

I want one secondary user group assigned if the member is under 16 and another secondary user group assigned if the member is under 21. Is this possible? Can someone suggest the code change?

Thanks
Reply With Quote
  #46  
Old 11-14-2006, 01:49 PM
RFViet RFViet is offline
 
Join Date: Jan 2006
Posts: 362
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by The Chief View Post
screen shots?
The same question !!
Reply With Quote
  #47  
Old 11-14-2006, 10:35 PM
makaiguy's Avatar
makaiguy makaiguy is offline
 
Join Date: May 2004
Location: Aiken, SC, USA
Posts: 150
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RFViet View Post
The same question !!
The same answer: There are no screen shots because nothing is displayed onscreen. It just sets the user's secondary usergroups when he logs on, according to whatever you have set up.
Reply With Quote
  #48  
Old 11-15-2006, 06:30 PM
Cocko Cocko is offline
 
Join Date: Oct 2006
Location: Germany
Posts: 143
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

any product scripts .xml out for 3.6x ?
Reply With Quote
  #49  
Old 12-07-2006, 01:31 PM
makaiguy's Avatar
makaiguy makaiguy is offline
 
Join Date: May 2004
Location: Aiken, SC, USA
Posts: 150
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've finally started playing with getting my board updated to 3.6 (3.6.4, actually).

AutoJoin has continued to work for me without modification to the original 3.5.4 installation.
Reply With Quote
  #50  
Old 12-08-2006, 01:42 AM
salata salata is offline
 
Join Date: Nov 2003
Posts: 252
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can you have them not enter the password at every login in? basically have them choose what usergroup they belong to at registration, I.E. if i had separate sections for men and women
Reply With Quote
  #51  
Old 12-08-2006, 01:57 AM
makaiguy's Avatar
makaiguy makaiguy is offline
 
Join Date: May 2004
Location: Aiken, SC, USA
Posts: 150
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by salata View Post
can you have them not enter the password at every login in? basically have them choose what usergroup they belong to at registration, I.E. if i had separate sections for men and women
The idea of this addon is that you create a special field in their profile. They enter the required value in this field in the profile one time, and on every subsequent login it checks for the required value in that profile field, and puts them into or out of the specified secondary user group.

[Edited to add] Code is provided to do this via several different formats for the custom profile field. You may do it as:
  1. Password for single usergroup (alternative to password-protected forum where user must enter password for every session - this way they only enter into their profile one time. Set your forum persmissions to only admit members of the specified usergroup.)
  2. Yes/No choice for single usergroup via radio button
  3. Choose one of several usergroups via radio buttons
  4. Choose any of several usergroups via multiple checkboxes
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:44 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04535 seconds
  • Memory Usage 2,328KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete