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)

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).


All times are GMT. The time now is 11:15 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.02315 seconds
  • Memory Usage 1,748KB
  • 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
  • (4)bbcode_code_printable
  • (3)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