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)

paulfletcher 03-13-2006 01:54 AM

Does this still work if I'm using CMPS on my board? Do I have to change the "Product" option in vbulletin from "vBulletin" to "CMPS" when I'm installing this?

paulfletcher 03-14-2006 12:49 AM

Anyone :-)...? So alone...

amykhar 03-14-2006 01:02 AM

Why wouldn't it and why would you? :confused:

paulfletcher 03-15-2006 02:30 AM

lol. I don't know. I'm new to vBulletin, and so far. When I've tried installing this script it still doesn't work. I've made sure my text field during registration is not hidden, and that it is field5, and that its upgrading to the correct usergroup ID. (just like your script). And I've tried typing in the correct information so my account can be upgraded, although... Still no luck. The newly registered user is still not being upgraded.

So I was thinking that it was probably my stupidity that was preventing the script from being correctly installed.

Any thoughts?

Thanks,
Paul Fletcher

paulfletcher 03-15-2006 02:49 PM

Would you, are someone be willing to help me install this plugin and get it working. I'll get you an admin login for our forum.

Thanks,
Paul

paulfletcher 03-16-2006 02:54 AM

Alright. So, our site has to open on March 27th, and I'm clueless on how to make this script work. After installing the script... Everything the same (except groupID has been changed from 10 to 11.

I get this error when I activate my account.

Parse error: parse error, unexpected '<' in /homepages/9/d89699556/htdocs/xyztraining_com/register.php(930) : eval()'d code on line 1

When looking in the registration.php file on line 930 I see this...

$hook = vBulletinHook::fetch_hook('register_activate_proce ss')) ? eval($hook) : false;

Does this help anyone figure out where my problem may be lying?

Thanks,
Paul

rnmcd 03-16-2006 02:57 AM

Quote:

Originally Posted by paulfletcher
Would you, are someone be willing to help me install this plugin and get it working. I'll get you an admin login for our forum.

Thanks,
Paul

Maybe it doesn't work with your version of vBulletin(?).

paulfletcher 03-16-2006 11:52 AM

Thats what I originally though as well, but Amykhar told me that she has it working on vBulletin 3.5.4.

Wouldn't this error
Quote:

Parse error: parse error, unexpected '<' in /homepages/9/d89699556/htdocs/xyztraining_com/register.php(930) : eval()'d code on line 1
suggest that there is an extra "<" somewhere in the script? Although I can't find it, and the ones that I do see I have no clue whether there actually supposed to be there. (I don't know PHP).

Any thoughts?

Thanks,
Paul

amykhar 03-16-2006 01:48 PM

paul, my software for work just went out the door and I have about half an hour of free time before I need to get back to work. PM me your admin info and I'll see what I can do for you.

paulfletcher 03-16-2006 08:42 PM

I sent the login credentials to you.

Thanks again,
Paul

paulfletcher 03-17-2006 09:47 PM

It's working Great! Thanks for your help.

-Paul

rnmcd 03-17-2006 09:54 PM

Quote:

Originally Posted by paulfletcher
It's working Great! Thanks for your help.

-Paul

Did amykhar happen to mention what the problem was?

paulfletcher 03-17-2006 10:11 PM

Ah yes... Sorry.

She said that the variables were different after email activation (in the script... I think). Thats all I know :-) But the script is now doing everything we need on our site.

Thanks,
Paul Fletcher

Sculli 03-18-2006 10:12 AM

This plug is awesome.
I would like to use it to have a radio-button single selection going on where users can switch as the please.

How would I go about accomplishing that? Just a bunch of if statements checking which groupid needs to be removed before assigning a new one?

paulfletcher 03-19-2006 03:22 AM

Are you talking about adding the radio-buttons in the user CP, so a user is able to switch between categories and user-groups as they want?

Thanks,
Paul

Sculli 03-19-2006 03:42 AM

Yes that is exactly it. The user will have the choice between usergroupA, usergroupB, and usergroupC. The choice is made using radio buttons, so the user can only be a member of one of the groups at any given time. But the user can switch groups at will through the Edit Profile.

paulfletcher 03-19-2006 02:03 PM

I actually looked into doing something like that. Where our activation code text field would be able to be changed in the login / privacy area. Although for this to work you would have to change the hook. Probably from register_activate_process to when you login.

Although I don't know how to do this (modifying the original script), you could just try playing around with the hook settings. So every-time the user logs in, the script is activated to see what the value of that radio button is.

Thanks,
Paul

rnmcd 03-19-2006 02:33 PM

Quote:

Originally Posted by Sculli
Yes that is exactly it. The user will have the choice between usergroupA, usergroupB, and usergroupC. The choice is made using radio buttons, so the user can only be a member of one of the groups at any given time. But the user can switch groups at will through the Edit Profile.

I was under the impression that is the way it is done presently.

Anyone happen to have this installed on a board that they could let me look at?

amykhar 03-19-2006 03:14 PM

The choice doesn't have to be radio buttons. A text field works as well. But, the choice can't be changed after the user registers. They would have to use the regular member group interface for that.

rnmcd 03-19-2006 03:52 PM

Quote:

Originally Posted by amykhar
The choice doesn't have to be radio buttons. A text field works as well. But, the choice can't be changed after the user registers. They would have to use the regular member group interface for that.

Oh I get it now. The user can't change their usergroup by changing the respective profile field in the UserCP.

When you say, "They would have to use the regular member group interface for that." "They" are Admins, not members, right?

amykhar 03-19-2006 05:01 PM

No. I mean members. Members can leave public groups and ask to join public groups. Combine this with my mod that pms group leaders when users make a request, and you'll have a usable interface.

I don't need my members to change groups after registration becuase except in very rare cases, I don't think their gender is going to change ;)

Sculli 03-19-2006 06:43 PM

Quote:

Originally Posted by amykhar
But, the choice can't be changed after the user registers. They would have to use the regular member group interface for that.

You mean as it is coded now it can't be changed? There is no reason it couldn't be changed if it was coded differently though, right?

I run an online game related message board, and users can have one of three allegiances. Depending on which allegiance they currently have, they are assigned to a usergroup that then assigns them a rank image that shows their allegiance. However, users can change their allegiance in game, and I would like them to be able to change their allegiance choice as well.

I currently use simple publically joinable usergroups. The issue with that is that a user could join multiple groups and thus display multiple allegiance rank images. Some users do, and it's annoying to me to have to hunt them down and tell them that they are misusing the allegiance option.

If I were able to make the allegiance choice a radio button choice in the profile, then they could only have one allegiance at a time, but they would need to be able to change it when they change it in game.

There ought to be a faily simple way to do that. Something along the lines of:
-radio button choice indicates user wants to be part of group A
-check whether user is part of group B already, if so, remove user from group B
-check whether user is part of group C already, if so, remove user from group C
-add user to group A

Murty 04-11-2006 03:49 AM

a few months ago i was having trouble installing the "Put User in Secondary Group Based on Custom Profile Field Value" hack. Well i thought it was all sorted, but for some reason, users are still being put into any random fields(eg male or female). I have not edited any code or anything, but it has been an increasing issue (having to manually change users).

Has anyone got any thoughts?

Please help

Injektilo 04-26-2006 08:38 AM

amykhar or even someone else...please help me out here

i have a gender field with 3 options (male,female,secret) how can i set males to have one secondary usergroup, for females another, and for those who selected ecret to remain as it is (dont get a secondary usergroup)

amykhar 04-26-2006 09:45 AM

It's just ifs and elseifs to handle three groups.

sepulchres 05-02-2006 08:47 AM

Is it possible to use this function based on two custom fields instead of one? If so, how would the code differ to the one above? Cheers.

ronoxQ 05-24-2006 12:05 AM

You'd just add another field to the plugin that looks for a different field.

Amy, here's my modified profile code, but it doesn't add me under a secondary usergroup. Any ideas?

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'] == 'North')
                {
                                        $membergroupids = $userdata->fetch_field('membergroupids');
                if ($membergroupids)
                {
                        $membergroupids = $membergroupids . ", 10";
                }
                else
                {
                        $membergroupids = 10;
                }
$userdata->set('membergroupids', $membergroupids);                }
// Get the value for field 5
        $user = $db->query_first("
                        SELECT field5
                        FROM " . TABLE_PREFIX . "userfield
                        WHERE userid = " . $vbulletin->userinfo['userid'] . "
                ");

                if ($user['field5'] == 'South')
                {
                                        $membergroupids = $userdata->fetch_field('membergroupids');
                if ($membergroupids)
                {
                        $membergroupids = $membergroupids . ", 11";
                }
                else
                {
                        $membergroupids = 11;
                }
$userdata->set('membergroupids', $membergroupids);                }
// Get the value for field 5
        $user = $db->query_first("
                        SELECT field5
                        FROM " . TABLE_PREFIX . "userfield
                        WHERE userid = " . $vbulletin->userinfo['userid'] . "
                ");

                if ($user['field5'] == 'West')
                {
                                        $membergroupids = $userdata->fetch_field('membergroupids');
                if ($membergroupids)
                {
                        $membergroupids = $membergroupids . ", 13";
                }
                else
                {
                        $membergroupids = 13;
                }
$userdata->set('membergroupids', $membergroupids);                }
// Get the value for field 5
        $user = $db->query_first("
                        SELECT field5
                        FROM " . TABLE_PREFIX . "userfield
                        WHERE userid = " . $vbulletin->userinfo['userid'] . "
                ");


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

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


amykhar 05-24-2006 11:37 AM

ronoxQ, I'm going to respond via pm.

ThePiston 06-06-2006 04:08 PM

I've got a 5-option radio field that I can't get to work corectly.

I sort of got it to work, but with this code, it it puts new members into 2 Groups, whatever they chose and always the last Group (the else clause) listed as well (so 2 groups). Where am I going wrong?

PHP Code:

// Get the value for field 20
    
$gender $vbulletin->db->query_first("SELECT * FROM userfield WHERE userid=".$vbulletin->userinfo['userid']);


        if (
$gender['field5'] == 'team1')
        {
            
$membergroupids $userdata->fetch_field('membergroupids');
            if (
$membergroupids)
            {
                
$membergroupids $membergroupids ", 9";
            }
            else
            {
                
$membergroupids 9;
            }

            
$userdata->set('membergroupids'$membergroupids);        
        }
        if (
$gender['field5'] == 'team2')
        {
            
$membergroupids $userdata->fetch_field('membergroupids');
            if (
$membergroupids)
            {
                
$membergroupids $membergroupids ", 11";
            }
            else
            {
                
$membergroupids 11;
            }

            
$userdata->set('membergroupids'$membergroupids);        
        }
        if (
$gender['field5'] == 'team3')
        {
            
$membergroupids $userdata->fetch_field('membergroupids');
            if (
$membergroupids)
            {
                
$membergroupids $membergroupids ", 10";
            }
            else
            {
                
$membergroupids 10;
            }

            
$userdata->set('membergroupids'$membergroupids);        
        }
        if (
$gender['field5'] == 'team4')
        {
            
$membergroupids $userdata->fetch_field('membergroupids');
            if (
$membergroupids)
            {
                
$membergroupids $membergroupids ", 12";
            }
            else
            {
                
$membergroupids 12;
            }

            
$userdata->set('membergroupids'$membergroupids);        
        }
        
        if (
$gender['field5'] == 'team5')
        {
            
$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);
    } 

*****EDIT**** I fixed it, I needed 'else if' and not 'if'

Shoebuddy 06-12-2006 09:41 AM

Can I write this code? or use a switch statement


Code:

if ($user['field5'] == 'MIS (Summer)')
{
    $membergroupids = $userdata->fetch_field('membergroupids');
    if ($membergroupids)
    {
                $membergroupids = $membergroupids . ", 45";
    }
}

if ($user['field5'] == 'MIS (Fall)')
{
    $membergroupids = $userdata->fetch_field('membergroupids');
    if ($membergroupids)
    {
                $membergroupids = $membergroupids . ", 45";
      }

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


futuredood 06-15-2006 08:57 PM

is their any way to make this a hack with a user interface?

amykhar 06-15-2006 09:38 PM

It's not the kind of mod that's really conducive for a user interface. It's one of those set it once and never touch it again kinds of things.

futuredood 06-16-2006 02:38 AM

hmm.. i'd like to have it so that people can select from the list. the thing is, if i have a list of five options, say A B C D E, and then I end up adding a 6th option and still wanted to maintain the ABC order, I'd place it between the A and the B. the problem with that is, users who selected B are now changed because the list changed by one line. any ideas?

patrickstar 06-28-2006 12:58 AM

ok this is what i did:
1. created new profile field: gender
2. value = 'M' or 'F'
3. created new usergroup: female
usergroup id: 10

i have made the neccesary changes to the xml file and now the silly question. how do i upload it to my plug in manager. i just save text and upload?

thanks and great hack.

paulfletcher 06-28-2006 04:29 AM

AdminCP > Plugin System > Plugin Manager > Add New Plugin

I think this is what your looking for.

Thanks,
Paul

paulfletcher 06-28-2006 04:31 AM

Oh, if you already have the plugin installed and you just want to make a code edit. Inside the Plugin Manager, click on the plugin you want to edit. Once the next page has loaded, located Plugin PHP Code... To the right of that is where you can edit your code.

Thanks,
Paul

patrickstar 06-28-2006 08:38 AM

Quote:

Originally Posted by paulfletcher
AdminCP > Plugin System > Plugin Manager > Add New Plugin


I think this is what your looking for.

Thanks,
Paul

yea i found that but my question is, how do i download the xml file? its not allowing me the option to save it, it just opens up to the text.

amykhar 06-28-2006 11:19 AM

Right click - > 'Save As'

patrickstar 06-28-2006 01:17 PM

lol. that easy uh?

well i just wanted to make sure, i havent uploaded a plug in yet.

thanks again, this is a great hack, that i am going to use.

patrickstar 06-29-2006 01:14 AM

hello amy can you help me out. i thought i did everything right.

1. i added new usergroup = 10
2. i have gender field '7'
3. i have required email verification
4. i have gender required at time of registration
5. M or F

this is what i have as php code:
// Get the value for field 7
$user = $db->query_first("
SELECT field7
FROM " . TABLE_PREFIX . "userfield
WHERE userid = " . $vbulletin->userinfo['userid'] . "
");

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

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


but when i enable the plug in, everything seems to go fine when registerring, but i get this message after following my registration link and logging in:

Your account has already been activated so please try logging in.

everytime i try to log in.

can you please help with any suggestions. thanks.


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.01372 seconds
  • Memory Usage 1,875KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (7)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