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
  #12  
Old 04-12-2006, 03:56 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 trigon
can i use this to divorce the guys from the girls in my board??
I assume you have two membergroups and want to put the user in one and remove from the other depending on their choice in their profile. I guess you could use this as a framework, but it would take some additional coding.

A wouldn't think a password text field is the best way to do this. As long as you're going to be modifying code anyway, a radio button would make more sense.
Reply With Quote
  #13  
Old 04-12-2006, 05:08 AM
x_5 x_5 is offline
 
Join Date: Aug 2005
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanxxxxxxxxxxx
Reply With Quote
  #14  
Old 04-12-2006, 02:51 PM
makaiguy's Avatar
makaiguy makaiguy is offline
 
Join Date: May 2004
Location: Aiken, SC, USA
Posts: 150
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code revised to version 1.02 - see first post in thread.

Rewritten using defined functions for adding to, and removing from, memberbgroups. This should make it easier to follow the logic and to make it easier for you to adapt the code for other situations (e.g. checkboxes or radio buttons instead of text profile fields).
Reply With Quote
  #15  
Old 04-12-2006, 03:59 PM
GamerzWorld's Avatar
GamerzWorld GamerzWorld is offline
 
Join Date: Aug 2003
Posts: 263
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by makaiguy
If I understand the question...

This just adds the user to the usergroup, the same as if you checked the box for that forum after pulling up his record in the admincp. Whether this usergroup and/or forum require moderation is unaffected by this.
Yes but as I am saying, I have several groups not moderated by an admin but by a user. Instead of just having to enter a password and automatically being joined, is it possible that they go into the default vbulletin moderation que in which the admin of the group has to accept there application before they can see it

So say for an example a clan called BobsArmy. Is it possible that BobsArmy can have a password, but once the user enters the password instead of being automatically joined into the BobsArmy usergroup he is added automatically to the application process which is found in the group membership page, allowing a second check by the group leader
Reply With Quote
  #16  
Old 04-12-2006, 05:12 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 GamerzWorld
Instead of just having to enter a password and automatically being joined, is it possible that they go into the default vbulletin moderation que in which the admin of the group has to accept there application before they can see it
Since I don't use that feature, I can't give you a definitive answer. But my GUESS is it will work exactly the same as if you went into the user's profile via the AdminCP and added him to the forum. If that throws him into the moderation queue then this hack should too, I'd think. If that bypasses the moderation queue, then I'd expect this hack would do the same.

Perhaps someone more familiar with that feature can give a more authoritative answer.

But in that case, as long as it requires moderator intervention anyhow, how would this be an improvement over the standard application process? The whole idea here was to eliminate moderator involvement.
Reply With Quote
  #17  
Old 04-12-2006, 05:20 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 makaiguy
I assume you have two membergroups and want to put the user in one and remove from the other depending on their choice in their profile. I guess you could use this as a framework, but it would take some additional coding.

A wouldn't think a password text field is the best way to do this. As long as you're going to be modifying code anyway, a radio button would make more sense.
I've thrown together some code modifications to do this via radio buttons. See the second post in this thread. Again, these modifications are UNTESTED so use at your own risk. [Code no longer in this post - see the download file]
Reply With Quote
  #18  
Old 04-13-2006, 03:41 AM
trigon trigon is offline
 
Join Date: Dec 2005
Posts: 91
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Understand i right, that for my problem i only modify this codes:
Code:
// Add or remove user from secondary usergroups
// according to radio button choice in user's profile
// (Choice of one of several forums)

  global $vbulletin;

// Enter values in the strings below for your forum
  // custom field containing your radio button
     $field = 'fieldX'
  // membergroup number associated with FIRST radio button choice 
     $mg[0] = 'XX';                     
  // membergroup number associated with SECOND radio button choice 
     $mg[1] = 'YY'; 
  // add additional radio button choices as needed 
                         
// Derive additional needed variables
  $userid = ($vbulletin->userinfo['userid']);                           // userid of user
  $mgarr = explode(',' , (''.$vbulletin->userinfo['membergroupids']));  // current membergroups as array

// Do the work  
  foreach ($mg as $value) 
  {
    $iii = 0
    {
      if ($field == pow(2,$iii))
      {
        InGroup($mgarr, $mg[$iii], $userid);
      } 
      else
      {
        OutGroup($mgarr, $mg[$iii], $userid);      
      } 
      $iii++ 
    }
  }
Reply With Quote
  #19  
Old 04-13-2006, 07:30 AM
GamerzWorld's Avatar
GamerzWorld GamerzWorld is offline
 
Join Date: Aug 2003
Posts: 263
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by makaiguy
Since I don't use that feature, I can't give you a definitive answer. But my GUESS is it will work exactly the same as if you went into the user's profile via the AdminCP and added him to the forum. If that throws him into the moderation queue then this hack should too, I'd think. If that bypasses the moderation queue, then I'd expect this hack would do the same.

Perhaps someone more familiar with that feature can give a more authoritative answer.

But in that case, as long as it requires moderator intervention anyhow, how would this be an improvement over the standard application process? The whole idea here was to eliminate moderator involvement.
Well the problem is that if the password is cracked then spies can easily gain access. My intention was to change password into Group, which would then allow users to apply for their clans group while registering without having to go to the group membership page and click apply. If you go to the admincp then you can simply tick the box and there in but I want them to go to the group leader for moderation before this
Reply With Quote
  #20  
Old 04-14-2006, 01:30 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 trigon
Understand i right, that for my problem i only modify this codes:
Edit your info into the code and use it to REPLACE the portion of the original code ABOVE the functions. (In other words, add the functions from the original post to the end of the above code.)

BUT, I'm now trying to get this running on a test system, and there are some syntax errors that I'm working on correcting. (I warned you that this was untested code.) Please check back later.
Reply With Quote
  #21  
Old 04-14-2006, 03:19 AM
trigon trigon is offline
 
Join Date: Dec 2005
Posts: 91
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by makaiguy
Edit your info into the code and use it to REPLACE the portion of the original code ABOVE the functions. (In other words, add the functions from the original post to the end of the above code.)

BUT, I'm now trying to get this running on a test system, and there are some syntax errors that I'm working on correcting. (I warned you that this was untested code.) Please check back later.
Here some information for you: i want to check if the user has in "field5" "women", then move him to usergroup "20". If he has "men", let him in this group.
Maybe you can wrote me a plugin, cause its to confusing for me what here is written, sorry.
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 09:50 PM.


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.07909 seconds
  • Memory Usage 2,324KB
  • 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_code
  • (7)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