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)

groeken 09-24-2007 08:10 PM

mhh.. then must be an error in my syntax, i think. Maybe anyone has an idea what is wrong..
the main problem is that if i had to activate more than 1 user at the same time the users will be put in the same group, allthough they had different choices for the selected field.

PHP Code:

$user $db->query_first("SELECT field8    FROM " TABLE_PREFIX "userfield WHERE userid = '" $vbulletin->userinfo['userid'] . "'");

if (
$user['field8'] == '1. Fachsemester') {
  
$membergroupids $userdata->fetch_field('membergroupids');
  if (
$membergroupids) {
      
$membergroupids $membergroupids ", 17";
    }
    else {
      
$membergroupids 17;
    }
  
$userdata->set('membergroupids'$membergroupids);        
}
elseif (
$user['field8'] == '2. Fachsemester') {
  
$membergroupids $userdata->fetch_field('membergroupids');
  if (
$membergroupids) {
      
$membergroupids $membergroupids ", 18";
      }
      else {
      
$membergroupids 18;
      }
    
$userdata->set('membergroupids'$membergroupids);        
  }
elseif (
$user['field8'] == '3. Fachsemester') {
  
$membergroupids $userdata->fetch_field('membergroupids');
    if (
$membergroupids) {
      
$membergroupids $membergroupids ", 19";
        }
        else {
          
$membergroupids 19;
        }
    
$userdata->set('membergroupids'$membergroupids);        
}
elseif (
$user['field8'] == '4. Fachsemester') {
  
$membergroupids $userdata->fetch_field('membergroupids');
    if (
$membergroupids) {
       
$membergroupids $membergroupids ", 20";
    }
    else {
      
$membergroupids 20;
    }
  
$userdata->set('membergroupids'$membergroupids);        
}
elseif (
$user['field8'] == '5. Fachsemester') {
  
$membergroupids $userdata->fetch_field('membergroupids');
    if (
$membergroupids) {
      
$membergroupids $membergroupids ", 21";
    }
    else {
    
$membergroupids 21;
  }
  
$userdata->set('membergroupids'$membergroupids);        
}
elseif (
$user['field8'] == '6. Fachsemester') {
  
$membergroupids $userdata->fetch_field('membergroupids');
    if (
$membergroupids) {
    
$membergroupids $membergroupids ", 22";
    }
    else {
     
$membergroupids 22;
    }
  
$userdata->set('membergroupids'$membergroupids);        
}
elseif (
$user['field8'] == 'Diplom oder spaeter') {
  
$membergroupids $userdata->fetch_field('membergroupids');
    if (
$membergroupids) {
     
$membergroupids $membergroupids ", 23";
    }
    else {
     
$membergroupids 23;
    }
  
$userdata->set('membergroupids'$membergroupids);        


any ideas?

groeken

dcw 04-15-2008 04:51 AM

Does this work for 3.7?

Ramsesx 04-20-2008 08:07 AM

Quote:

Originally Posted by dcw (Post 1490946)
Does this work for 3.7?

Yes it works for me on 3.7 RC1

Mum 05-15-2008 11:58 PM

Doesn't work for me on 3.7 gold, database error apon sign up.

MG Webmaster 06-09-2008 09:12 PM

So does it work on 3.7.1????

biome.pat 09-17-2008 03:42 PM

Hey folks! I've read through this whole thread, and can't seem to find anyone with the same problem (except maybe Murty in post #63). It seems that the plugin works for most registrations, but a few users end up in the wrong category. To explain, I've got it set up so field5 is a single-selection menu where members/students pick their year of study. I have it set up so that if they pick "Year 1" from the pull-down (instead of the other options of "Year 2", "Year 3", "Year 4+", "Grad Student" or "Alumni/Other"), they're put in a special usergroup with different forum access (called "Year - 1"), while if they pick anything else, they're put in another usergroup (called "Year - Other").

Settings are like so:

Set Default: Yes, Including a First Blank
Field Required: Yes, at Registration and Profile Updating
Field Editable by User: Only at Registration
Private Field: No
Field Searchable on Members List: Yes
Show on Members List: Yes

Every few days, I've been doing a search for students who have both "Year 1" chosen in the profile field, and are in "Year - Other" usergroup. If I'd set this up correctly, there shouldn't be any users found, but there are always a few.

Any ideas? It might be important to mention that the board has a high registration volume at the beginning of the academic year, so we've had over 1000 new users in 48 days.

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 1')
        {
            
$membergroupids $userdata->fetch_field('membergroupids');
            if (
$membergroupids)
            {
                
$membergroupids $membergroupids ", 13";
            }
            else
            {
                
$membergroupids 13;
            }

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

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

Any insight would be muchly appreciated!

biome.pat 09-17-2008 05:10 PM

Alright, so after doing 30 or so registrations is different browsers (and changing "Set Default" to "No", so that each registrant has so select the menu and choose an option (as opposed to first year's just seeing it already selected and leaving it), it seems it's an IE issues. After I changes the "Set Default" option, firefox never seems to have any problems (an it did once or twice before), but IE never puts them in the right category. They automatically end up in the usergroup indicated by the else statement (id:14 or "Year - Other"). Any ideas here folks? I'm baffled!

Levo1980 12-30-2008 03:30 PM

sorry my english ist not the best
i have import the xml and befor i import this i have changed this like this:

Code:

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


                if ($user['field8'] == 'weiblich')
                {
                                        $membergroupids = $userdata->fetch_field('membergroupids');
                if ($membergroupids)
                {
                        $membergroupids = $membergroupids . ", 10";
                }
                else
                {
                        $membergroupids = 10;
                }

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

But it doenst work....
I use VB 3.6.6 and on fild8 they have to select m?nnlich or weiblich (male or female), i want that all "weiblich" go to the secondary usergroup ladies which have the the ID:10.

Can somebody help me???

Bellinis 02-26-2009 09:55 AM

Dear amykhar & others,

I'd been looking for such mod for a long time. Will this one still work for 3.8? I'm affraid not....
Is there an updated version of some similar mod?

Thanks a lot in advance!

sensimilla 04-07-2009 02:22 PM

Quote:

Originally Posted by Bellinis (Post 1755069)
Dear amykhar & others,

I'd been looking for such mod for a long time. Will this one still work for 3.8? I'm affraid not....
Is there an updated version of some similar mod?

Thanks a lot in advance!


Same here.. I am in need of this hack.


All times are GMT. The time now is 04:58 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.01395 seconds
  • Memory Usage 1,789KB
  • 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
  • (2)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)pagenav_pagelinkrel
  • (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