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)

Valentino 02-14-2006 05:56 PM

Please... https://vborg.vbsupport.ru/external/2006/02/11.gif

Valentino 02-16-2006 08:18 PM

C'mon, who do I have to kiss to get some help?

paulfletcher 02-28-2006 01:28 PM

Can someone help me, I added this plugin to our website (XYZ Training) and when clicking on the activation link that is sent automatically to your email account I get a parse error. (See Attachment)

I think I installed the plugin correctly, and I made sure I enter the correct information into the code before I uploaded the xml file. I double checked the group ID, and the usergroup ID. I also verified the contents that will be entered into the text field.

Thanks,
Paul

paulfletcher 03-10-2006 07:10 PM

Has anyone got this to work on 3.5.4, and would like to help me out?

Thanks,
Paul

amykhar 03-11-2006 12:50 AM

Paul, it's been running on my board since the early betas and still works on 3.5.4

paulfletcher 03-11-2006 05:45 AM

Thanks for getting back to me. I wasn't sure if it still worked for 3.5.4. I'm working on an Activation Code text field that would appear during registration. This would allow for a community license to be issued to a school or company (we will be creating video tutorials).

After talking to other users they suggested that I use the secondary usergroup script that you created, this would allow me to easily demote a group of users back to a normal registered usergroup if needed.

Will your primary or secondary script that you created work with text fields? Or only Radio & Check boxes?

Thanks,
Paul

amykhar 03-11-2006 03:15 PM

text fields will work as well.

trigon 03-31-2006 10:43 PM

amykhar, you wrote:
Code:

NOTE: This mod works for forums that require users to verify their email address upon registration. If your forum does not require users to verify their email address, you will need to use a different hook. If I have time, I'll test that variation.
So on my Board i have no email verifycation, can i use this one too, or must i wait until your next variation??
(Btw: I tried but it doesnt go) :(

harmor19 04-05-2006 12:06 AM

Is it possible to assign an user to an usergroup depending the value of the profile field after they have registered?

Let me explain.
I run a hosting forum and some members don't even use their hosting account.
I send out an email telling that they haven't used their (sub)domain and that need to reply to the email.
After I send the email I edit their profile and select "Warned" from the drop down list. I also have "Suspended" (from the hosting) and "Terminated".

amykhar 04-05-2006 02:15 PM

It's possible to do it, just not with this mod.

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

ToastBusters 07-07-2006 04:51 PM

Hey,

I would like to have a the usergroup be based on the email domain. i.e. if the register with one domain they get put in a special usergroup but if it's any other domain they are simply put into registered users. Is this possible with this plugin?

Thanks!

paulfletcher 07-07-2006 05:12 PM

Hello. You can definitely set it up so if a user is from a certain domain they get put into a special user-group. You just setup a text field, and point this script towards this text field, and your good to go. You could probably setup the script to do an "if and or" statement. If it's from this domain do this, otherwise do this. But I'm not the person to ask about how to program this... But it can be done.

Thanks,
Paul

ToastBusters 07-07-2006 05:16 PM

Do you know off the top of your head what the variable is that holds the users email address? I could just get the domain off of that.

paulfletcher 07-07-2006 05:19 PM

I don't know off the top of my head what this variable is. You could try contacting vBulletin.com support.

Thanks,
Paul

cddw.ltd 07-11-2006 09:58 AM

Anyone got any links to a similar system that would allow users to either switch their primary usergroup or secondary at any time via the control panel?

Aurons Ghost 07-27-2006 10:09 AM

Thank you for this mod. It was just what I was looking for :)

on a side note though, if you don't have email confirmation, do you know which hook to use?

Neo_obs 08-02-2006 05:24 AM

I have a question is there anyway to mass add the users that have already registered to that usergroup?

if i ran this as a cron would it do it?

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

if ($user['field11'] == 'No')
{
$userdata->set('usergroupid', 18);
}

or if i add it as a hook somewhere else on the site? like forumhome?

Neo_obs 08-10-2006 05:08 AM

Can anyone tell me what other hooks I can use this doesnt work on our forums if they activate manually.

rb290 08-21-2006 11:23 PM

Quote:

Originally Posted by Neo_obs
Can anyone tell me what other hooks I can use this doesnt work on our forums if they activate manually.

same deal ^

i dont use email verification so is there any other solution to make this hack work cause i need it...

cavyspirit 08-26-2006 02:50 PM

How is this for 3.6? I absolutely need this one.

kall 09-15-2006 09:26 PM

Working fine for me on 3.6.0 and 3.6.1 :)

ricker 09-21-2006 10:53 PM

I thought it wasn't working, but then through troubleshooting I realized that the value of my field couldn't have both numbers and letters. I switched it to just letters and my test account was properly switched into the new usergroup.

If I want to set up multiple "custom registration codes," can I duplicate this script and rename it, changing the values?

kderentz 09-29-2006 06:18 PM

Quote:

Originally Posted by kall
Working fine for me on 3.6.0 and 3.6.1 :)

Glad to hear this works on 3.6.1 as that what I plan on using it on.


Amy this hack is exactly what I have been looking for except I have a couple of questions.

I've set up a custom user profile field that asks the user upon registration if they are a reatil buyer or wholesaler and I'm using a radio button to ask them.

Now with your code if they select on item it puts them in a certain user group, but what if they pic the other? do they just go in the default user group?

I want it to place them in eaither group depending on what they pic. I hope this makes sense.

amykhar 09-29-2006 06:30 PM

This mod is more of a template for you to decide what you want to do with users based on that profle field. You code the logic of where they are sorted. The mod itself hooks to the right place and gets you started so you can see how to inspect the value of the field and how to put the user in a group.

kderentz 09-29-2006 06:39 PM

Quote:

Originally Posted by amykhar
This mod is more of a template for you to decide what you want to do with users based on that profle field. You code the logic of where they are sorted. The mod itself hooks to the right place and gets you started so you can see how to inspect the value of the field and how to put the user in a group.

Thats where im limited as my code knowledge is lacking :confused:

Could you help me out with this ...

say my user field is 5 and my options are Dealer or End User

my user group for Dealers is 10 and my user group for End Users is 11

would my code look something like this???:
Code:

                if ($user['field5'] == 'Dealer')
                {
                        $userdata->set('usergroupid', 10);
               
                if ($user['field5'] == 'End User')
                {
                        $userdata->set('usergroupid', 11);


RFViet 10-10-2006 07:53 PM

Installed, it would be helpful to my forum :D

vietkieu_cz 10-19-2006 02:32 PM

I need this plugin for my forum. :)

kall 10-19-2006 06:09 PM

Quote:

Originally Posted by vietkieu_cz
I need this plugin for my forum. :)

Given that there's no vB verson 5.0.55, perhaps I could suggest you tell us what version you are running.

(It works on 3.5.x and 3.6.x).

vietkieu_cz 10-19-2006 06:35 PM

Quote:

Originally Posted by kall
Given that there's no vB verson 5.0.55, perhaps I could suggest you tell us what version you are running.

(It works on 3.5.x and 3.6.x).

I'm using vBb version 3.6.2 not 5.0.55 (I'm just joking):P
I think that all vBb customers use the newest vBb version.

Oreamnos 10-29-2006 03:11 AM

Quote:

Originally Posted by Neo_obs
Can anyone tell me what other hooks I can use this doesnt work on our forums if they activate manually.

Quote:

Originally Posted by rb290
same deal ^

i dont use email verification so is there any other solution to make this hack work cause i need it...

I'd also be interested in knowing which hook to use if the account does not require email verification. :)


All times are GMT. The time now is 07:25 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.01325 seconds
  • Memory Usage 1,849KB
  • 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
  • (3)bbcode_code_printable
  • (3)bbcode_php_printable
  • (9)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