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 Primary Usergroup Based on Value of Custom Profile Field (https://vborg.vbsupport.ru/showthread.php?t=82992)

JAV-ISH 04-19-2006 09:22 PM

If I use moderated public groups, the user is active in this group without moderation. Is there a workaround?

amykhar 04-19-2006 10:38 PM

what do mean by moderated public group? A group where the leader must approve the members? This mod is not intended to work with such groups.

sepulchres 05-01-2006 11:30 AM

Quote:

Originally Posted by amykhar
what do mean by moderated public group? A group where the leader must approve the members? This mod is not intended to work with such groups.

I'm also getting a parse error when I activate the account of the registered user. It seems that a lot of people are getting the same thing when using this hack. I read that Paul was having similar problems and Amy, you fixed it...But that was in the secondary one. Is there anything I can do to fix mine because it seems to be a similar problem that I am having. Cheers.

btw, I have checked all the userids and options of the custom field. I am using custom groups which are not public and emails must be verified by users. Here is the php code from the plugin...

Code:

Plugin PHP Code
// Get the value for field 5
        $user = $db->query_first("
            SELECT field5
            FROM " . TABLE_PREFIX . "userfield
            WHERE userid = " . $vbulletin->userinfo['userid'] . "
        ");


        if ($user['field5'] == 'Year 9')
        {
            $userdata->set('usergroupid', 9);

        if ($user['field5'] == 'Year 10')
        {
            $userdata->set('usergroupid', 10);

        if ($user['field5'] == 'Year 11')
        {
            $userdata->set('usergroupid', 11);

        if ($user['field5'] == 'Year 12')
        {
            $userdata->set('usergroupid', 12);
        }


paulfletcher 05-01-2006 12:18 PM

Hey. :) Well It was working for the secondary user-group. Although I found out that I needed one for the primary group. So Amykhar helped me out with this slight modification of the script... Works on my board (3.5.4).

PHP Code:

switch($userinfo['field5'])
{
    case 
"A":    
        
$userdata->set('usergroupid'12);
    break;
    case 
"B":
        
$userdata->set('usergroupid'13);
    break;
    case 
"C":
        
$userdata->set('usergroupid'18);
    break;


Talk to you later,
Paul F

amykhar 05-01-2006 12:19 PM

Because this mod requires you to change the code for it to work, you really need to be careful when making the changes. You haven't closed the braces on your first three if clauses, which is what's giving you the parse errors. I'm sorry, but I can't keep fixing these problems on an individual basis here and am referring any further issues to my premium support forum.

Tory H 05-19-2006 04:18 PM

Hi Amy,
I need this mod to read a different field (referrer) rather than profile field.

Basically the user is put into a usergroup based on what field is filled out as referrer (automatically passed from URL). Basically if they are my referral they are top dog permissions because they are somebody who I can trust, if a troll refers them then maybe they get put into a special group.

Will this work do you think?
Thx
Matt

futuredood 06-16-2006 03:10 AM

Quote:

Originally Posted by paulfletcher
Hey. :) Well It was working for the secondary user-group. Although I found out that I needed one for the primary group. So Amykhar helped me out with this slight modification of the script... Works on my board (3.5.4).

PHP Code:

switch($userinfo['field5'])
{
    case 
"A":    
        
$userdata->set('usergroupid'12);
    break;
    case 
"B":
        
$userdata->set('usergroupid'13);
    break;
    case 
"C":
        
$userdata->set('usergroupid'18);
    break;


Talk to you later,
Paul F

I presume this means you can let the user input the actual text in the case "X" area, correct? In that case, can you tell me where I would place this in the XML file?

I plan on having available more usergroups in the future, and would like to have the individual be able to type in the group they are entering (I'd have a link to the possibilities on the registration page).

Also, has their been any changes so that this could work all the time (for example, they can change their usergroup as they like through edit profile)? Thanks.

ThePiston 06-19-2006 08:02 PM

can someone post some working, multi-item xml code? I got mine working for multiple raio buttons with the secondary code, but i switched all of those groups to 'non-joinable custom/primary' usergroups and now I get nothing showing up when Iclick the registration email link and I can't get it to work. I've trid every combination i can think of... Ive got the right field, correct spelling and syntax, groups... i think i need to see someone's successful code for a multi-item xml file to compare. tia

this is the code i have now that does not want to work:
PHP Code:

// Get the value for field 5 
        
$user $db->query_first(
            SELECT field5 
            FROM " 
TABLE_PREFIX "userfield 
            WHERE userid = " 
$vbulletin->userinfo['userid'] . 
        "
); 


        if (
$user['field5'] == 'Yes'
        { 
            
$userdata->set('usergroupid'15); 
            } 
             
         else if (
$user['field5'] == 'No'
        { 
            
$userdata->set('usergroupid'17); 
            } 
             
         else if (
$user['field5'] == 'Always'
        { 
            
$userdata->set('usergroupid'19); 
            } 
             
         else if (
$user['field5'] == 'Never'
        { 
            
$userdata->set('usergroupid'20); 
            } 

I tried using all 'if's but that didn't work either... i'm not too hip on PHP, but i should be able to crack this?!

JazzleBug 06-30-2006 05:18 PM

This installed beautifully, Amy! I'm all about automation and this cuts down on quite a bit of work for me. Thank you!

amykhar 06-30-2006 05:51 PM

happy to be of service :)


All times are GMT. The time now is 10:51 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.01224 seconds
  • Memory Usage 1,764KB
  • 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_php_printable
  • (2)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