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)

patrickstar 06-29-2006 11:08 PM

ok so basically i have the plug in enabled, i have email verification on and the code as above. i have registered usergroup permissions to the girls forum off and the custom permissions for the custom usergroup 'female' granted. will the registerred usergroup settings over ride the 'female' usergroup settings on this? and when i register as a female with the required field 'F', i do not see that as a secondary usergroup.

please help, even suggestions.

patrickstar 06-30-2006 08:40 PM

<font size="1">chirp</font>

JenniferK 08-28-2006 04:10 PM

Quote:

Quote:
Originally Posted by Cyricx
Would it be possible to use this code to check their and thereby age?

Like I have an 18+ forum that I use a secondary usergroup to control access to.

Quote:
Originally Posted by amykhar
Yes, you could use this basic structure. It wouldn't check the value of the userfield. It would do the math on their age.

Amy
Can I have a little help with how to do this exactly?

moonclamp 09-08-2006 02:37 PM

Can anyone tell me the SQL query I'd need to run if I wanted to add the relevent existing members to the secondary group too?

criscokid 09-16-2006 10:16 AM

Quote:

Originally Posted by moonclamp
Can anyone tell me the SQL query I'd need to run if I wanted to add the relevent existing members to the secondary group too?

Take a look at the mySQL commands - make user a secondary usergroup member thread.

moonclamp 09-16-2006 10:47 AM

Quote:

Originally Posted by criscokid

Cheers :)

criscokid 09-17-2006 10:16 AM

How would I edit the XML file to add users to Usergroup ID 15 when Profile field16 = Male and Profile field17 = 1 or 2?

criscokid 09-18-2006 06:20 PM

Quote:

Originally Posted by moonclamp
Can anyone tell me the SQL query I'd need to run if I wanted to add the relevent existing members to the secondary group too?

Following on from my previous post elling you how to achieve this... I ran the two commands and now I all of the females are now members of the secondary group that I was setting. I assume this is beacuse the 'Male' appears in the word 'Female'?

Toopac 09-24-2006 03:06 PM

What would i need to do to get this working with email validation turned off?

I have not downloaded or installed anything yet.

Any help is most appreciated:cool:

wes_517 12-01-2006 01:52 AM

While trying to find something that will require moderation before giving access to the group, I saw a few people were interested, here's one version of code, it may not be pretty, but it works...

it also doesn't email out, but it does the job.

when they register, if field 23 is a hit, it adds them into the moderation table of the database.

PHP Code:

// Get the value for field 23
        
$user $db->query_first("
            SELECT field23
            FROM " 
TABLE_PREFIX "userfield
            WHERE userid = " 
$vbulletin->userinfo['userid'] . "
        "
);
        
$id $vbulletin->userinfo['userid'];
        
$time time();
        
$sql_string "SELECT field23
            FROM " 
TABLE_PREFIX "userfieldWHERE userid = " $vbulletin->userinfo['userid'] . "";



        switch (
$user['field23']) {
        
            case 
"CASE1":
            break;
            
            case 
"CASE2":
                
$sql_string "INSERT INTO vb_usergrouprequest (userid, usergroupid, reason, dateline) 
                    VALUES ('
$id','77','New Registration','$time')";
            break;
            
            case 
"CASE3":
                
$sql_string "INSERT INTO vb_usergrouprequest (userid, usergroupid, reason, dateline) 
                    VALUES ('
$id','67','New Registration','$time')";
            break;
            
            case 
"CASE4":
                
$sql_string "INSERT INTO vb_usergrouprequest (userid, usergroupid, reason, dateline) 
                    VALUES ('
$id','14','New Registration','$time')";
            break;
            
            case 
"CASE5":
                
$sql_string "INSERT INTO vb_usergrouprequest (userid, usergroupid, reason, dateline) 
                    VALUES ('
$id','13','New Registration','$time')";
            break;
            
            case 
"CASE6":
                
$sql_string "INSERT INTO vb_usergrouprequest (userid, usergroupid, reason, dateline) 
                    VALUES ('
$id','32','New Registration','$time')";
            break;
            
        }
    
$answer $db->query_first($sql_string); 

I can do PHP, but efficiency isn't a strong point within VB yet for me, so if anyone would like to improve the code, feel free and I'd appreciate it.

the duplicate SQL string is me after a long day just trying to make sure that SOME sql happens if none of the cases are hit, it would probably be just as good to check the sql to see if there is a string...

Murty 12-10-2006 10:18 PM

Does anyone know if this will work for 3.6?

Woot for 200 posts :)

Mum 01-16-2007 02:00 AM

I was wanting it for 3.6 as well, any ideas anyone?

Murty 01-22-2007 05:10 AM

amykhar said that she has it working, so it should probly work.

FireFish 01-25-2007 03:28 PM

It would be nice to be able to allow multiple instances of this running for different user groups based on different values.

Mum 01-25-2007 05:44 PM

Not sure what i'm doing wrong, here is the code i'm using, it is field5 that i'm wanting, and 'Female' is what i'm looking for, to put into group 33, if they aren't Female, then group 2. What have i done wrong?

Code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<plugins>
        <plugin active="1" product="vbulletin">
                <title>Put User in Secondary Group Based on Custom Profile Field Value</title>
                <hookname>register_activate_process</hookname>
                <phpcode><![CDATA[// Get the value for field 5
        $user = $db->query_first("
                        SELECT field5
                        FROM " . TABLE_PREFIX . "userfield
                        WHERE userid = " . $vbulletin->userinfo['userid'] . "
                ");


                if ($user['field5'] == 'Female')
                {
                                        $membergroupids = $userdata->fetch_field('membergroupids');
                if ($membergroupids)
                {
                        $membergroupids = $membergroupids . ", 33";
                }
                else
                {
                        $membergroupids = 2;
                }

                $userdata->set('membergroupids', $membergroupids);                }]]></phpcode>
        </plugin>
</plugins>


FireFish 01-26-2007 08:40 PM

Quote:

Originally Posted by Mum (Post 1167146)
Not sure what i'm doing wrong, here is the code i'm using, it is field5 that i'm wanting, and 'Female' is what i'm looking for, to put into group 33, if they aren't Female, then group 2. What have i done wrong?

Code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<plugins>
        <plugin active="1" product="vbulletin">
                <title>Put User in Secondary Group Based on Custom Profile Field Value</title>
                <hookname>register_activate_process</hookname>
                <phpcode><![CDATA[// Get the value for field 5
        $user = $db->query_first("
                        SELECT field5
                        FROM " . TABLE_PREFIX . "userfield
                        WHERE userid = " . $vbulletin->userinfo['userid'] . "
                ");


                if ($user['field5'] == 'Female')
                {
                                        $membergroupids = $userdata->fetch_field('membergroupids');
                if ($membergroupids)
                {
                        $membergroupids = $membergroupids . ", 33";
                }
                else
                {
                        $membergroupids = 2;
                }

                $userdata->set('membergroupids', $membergroupids);                }]]></phpcode>
        </plugin>
</plugins>


Here's your problem:
Code:

{
                        $membergroupids = 2;
                }

Should be:
Code:

{
                        $membergroupids = 33;
                }

It knows to put others who enter anything but Female into 'Users Awaiting Confirmation'

JoeZ 03-17-2007 04:35 PM

How do I update the currently registered users for this? Where to I place the hook?

I'm using it as a gender mod.

FireFish 03-19-2007 03:41 PM

Good question: Here's what I did:

I made the new Profile Field for this mod as 'Private', which means once it is entered, the field doesn't show up to be editted by the user or shown.
However, the problem lies in the existing users.
What you do is run a SQL Statement to update the value of that field for all users to, say, 'none'.

This script only works for new registrations ongoing.
If a user adjusted the value of that field, it won't add them to your secondary group unless it was while they were registering.

You should make the default value 'none' & instruct your visitors to only fill in their 'Invitation Code' if they were given one.

Medina 04-12-2007 07:37 PM

I'm having a problem with this nice hack.

When NEW members on my forum register and choose from the custom-field (male or woman) they won't see at all the special corners that are made for male/woman members. This hack does work with existing members. Who could help me with this.

At the begin it worked fine, but now it seems their is a strange problem with it, i self think that it's at the hook location.

I would be thankfull.

Medina

MAXpowerPXL 04-16-2007 07:38 AM

Quote:

Originally Posted by banjolawyer (Post 868131)
Would this plugin work for adding a user to more than one secondary usergroup? For example if I added a "multiple selection checkbox" custom profile field, could it add the user to 2 or 3 differnt public usergroups if the user checks 2 or 3 checkboxes?

Quote:

Originally Posted by sensimilla (Post 785810)
so it can work with only one choice..?

what if I want "male" "female" "couple" to create 3 different usergrups?

TIA

:confused: I am also wondering about this..

I have about 10 usergroups.. I would like to let users join one more (even all).

Medina 04-16-2007 09:26 AM

dear amy,

is this plugin also for 3.6 suitable?

Regards

Medina

asaeed 04-25-2007 03:00 PM

amy
i want to use your ads with out
require users to verify their email address upon registration
i dont use that in my fourm

Medina 05-20-2007 03:10 PM

can i please have a reply on my question :o

Murty 05-20-2007 11:42 PM

Quote:

Originally Posted by Medina (Post 1251462)
can i please have a reply on my question :o

Hey medina, i dont think you will be able to contact amy through this thread. you will probably have to send her a pm. But to save you the hassle, i have already PMed her and she said it works fine, but i have put it on and stuff around with it for ages and still havent go it to work. I now have someone making a whole new mod for me. Once hes finished it and ive tested it, i will let you know and you might be able to buy a copy from him if you really need it.

Hope that helps.

Medina 05-21-2007 06:35 AM

Quote:

Originally Posted by Murty (Post 1251765)
Hey medina, i dont think you will be able to contact amy through this thread. you will probably have to send her a pm. But to save you the hassle, i have already PMed her and she said it works fine, but i have put it on and stuff around with it for ages and still havent go it to work. I now have someone making a whole new mod for me. Once hes finished it and ive tested it, i will let you know and you might be able to buy a copy from him if you really need it.

Hope that helps.

Hello Murty,

Thank for your reply.

I'm two days busy with Amy's plugin, but i won't work on 3.6.5. I think that you first have to install vb 3.5. and install Amy's plugin and so you have to upgrade it to 3.6.

Is that maybe a option? Or am i talking bullshit. :D

Anyway if your new mod is all done Murty can you please response on this topic, so i can take a look to the new mod.

Thank you

Regard,

Medina

Murty 05-22-2007 08:21 PM

Yeah i stuffed around with it as well. To be honest the mod didnt really ever work for me properly on 3.5 anyways. I am still awaiting for my mod to be completed, but i will let you know when its done.

Murty 05-29-2007 10:49 PM

Hey guys,

For those of you interested, a guy has created a modification that will move users to a specified usergroup depending on a profile field selection.
For me, when a user registers, they need to select whether they are male or female. Once they have registered, depending on whether they selected male or female, they get moved to the male or female user group i created.

You are able to get this mod by sending an email to: hugh@alaweb.com and requesting the 'user profile group modification'.
This mod was not made for free, so it will cost you $25.00 US.

I have tested it with vb 3.6.5 and it works great, highly recommend!

PM me if you want more info.

ahmedeldeep 07-09-2007 05:51 PM

Thank you

groeken 09-22-2007 07:57 PM

Hello,
is anybody here using this mod on vb 3.6.8? Im not sure but on my site it wont work.

Mum 09-24-2007 06:28 PM

I am, and it's working fine :)

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 11:57 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.01417 seconds
  • Memory Usage 1,910KB
  • 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
  • (5)bbcode_code_printable
  • (3)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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