vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Random Usergroup on registration (https://vborg.vbsupport.ru/showthread.php?t=68566)

dstruct2k 08-19-2004 10:00 PM

Random Usergroup on registration
 
Ever wanted to randomly sort your new registrants into seperate usergroups?

Now you can!

Good for Harry Potter themed forums. ;)


Instructions: Create the usergroups you want to randomly sort between and record the usergroupid's for use when installing the hack. Further instructions in TXT file.

File Modifications: 1 (register.php)

Template Mods: 0

Time to install: >2 minutes


Enjoy!

Update: Version 2.0 released
This version incorporates code by True.Rooster which fixes my half-assed attempts at getting the code right. (It's been a while... lol)

To upgrade, reapply the hack.

assassingod 08-20-2004 06:30 PM

Nice:)

Reeve of shinra 08-20-2004 06:32 PM

Pretty cool.

KW802 08-20-2004 06:34 PM

Would there then be an easy way for the user to change their group post registration? I could see something like this hack being fun for RPG type sites.

Merjawy 08-21-2004 12:42 AM

Nice indeed

but I don't want to do a random thningy :) I want to simply make new users register into a usergroup of my choosing, not the default usergroupID 2 , can I do that with this? :)

thnx

nighteyes 08-21-2004 12:46 AM

Do you have a script to automatically assign random usersgroups to existing members too (excluding moderators and admins)? :) So you can run the script once.... everyone would be assigned a certain group, then randomly add people to new groups as they register.

dstruct2k 08-21-2004 04:19 AM

Quote:

Originally Posted by Merjawy
Nice indeed

but I don't want to do a random thningy :) I want to simply make new users register into a usergroup of my choosing, not the default usergroupID 2 , can I do that with this? :)

thnx

Just only put one group, that'd do it.



Quote:

Originally Posted by nighteyes
Do you have a script to automatically assign random usersgroups to existing members too (excluding moderators and admins)? :) So you can run the script once.... everyone would be assigned a certain group, then randomly add people to new groups as they register.

No, I don't, as I coded this for a request, not for my own usage.... I think one could be written though, I just will have to find time... They gave me shifts every day this week at work so I'll be hard-pressed for time.

integra99 08-21-2004 06:28 AM

dstruct2k: what is the application of this hack on your site?

b4ne 08-21-2004 02:14 PM

Coudl this be changed so that the user has some otions like

1
2
3

and whatever option he chooses when register he gets put into a specific usergroup ?

isla142 08-22-2004 01:08 PM

This doesn't appear to be working. I put it on my site and signed up as a new member, but for some reason they were placed in 'COPPA users awaiting moderation' (group 4)

I had put the four usergroups as 2 (Gryffindor), 9 (Hufflepuff), 10 (Ravenclaw) and 11 (Slytherin). Maybe you need to check your code. I did a straight copy with the numbers changed.

Merjawy 08-22-2004 07:27 PM

Quote:

Originally Posted by dstruct2k
Just only put one group, that'd do it.

thnx mate, will try that

dstruct2k 08-30-2004 07:38 AM

Quote:

Originally Posted by isla142
This doesn't appear to be working. I put it on my site and signed up as a new member, but for some reason they were placed in 'COPPA users awaiting moderation' (group 4)

I had put the four usergroups as 2 (Gryffindor), 9 (Hufflepuff), 10 (Ravenclaw) and 11 (Slytherin). Maybe you need to check your code. I did a straight copy with the numbers changed.

That would be because you're requiring email verification or COPPA registration. This hack doesn't support verification yet.

Quote:

Originally Posted by integra99
dstruct2k: what is the application of this hack on your site?

No application. Wrote it for someone else. ;)

isla142 08-30-2004 10:41 AM

Quote:

Originally Posted by dstruct2k
That would be because you're requiring email verification or COPPA registration. This hack doesn't support verification yet.

That's the thing. I don't require e-mail verification or COPPA registration on my site, which is why I needed the original hack that I asked for modified. :disappointed:

Wifey 10-31-2004 07:50 PM

I don't require e-mail, COPPA registration, image verification, nor birthday's ro register. I just changed the not requiring birthday and am hoping that this alleviates the problem I'm having, but for some reason or other a few people have been thrown into that COPPA group up on registration. Any ideas?

Here's my PHP code verbatim from my DB:

PHP Code:

// RANDOM USERGROUP HACK by dstruct2k
// Replace "999" with the usergroupid's of your randomized groups.
// Add extra groups if required.

    
$rndgroups = array(
        
'10',
        
'11',
        
'13');
    
$rndid $rndgroups[rand(0,count($rndgroups) + 1) - 1];

    
// assign user to group 3 if email needs verification
    
if ($vboptions['verifyemail'])
    {
        
$newusergroupid 3;
    }
else
    {
        if (
$vboptions['moderatenewmembers'] OR $_POST['coppauser'])
        {
            
$newusergroupid 4;
        }
        else
        {
            
$newusergroupid $rndid;
        }
    }

// END RANDOM USERGROUP HACK by dstruct2k 


Wifey 10-31-2004 11:43 PM

Okay, since I'm wickedly impatient I decided to see about figuring this out on my own. After disabling virtually everything and still having the problem, I realized that the hack was rotating improperly and therefore throwing people into COPPA - problem is, they weren't IN the COPPA usergroup. The query had somehow created a NEW usergroup with no name and no id number that can't be modified. All as a result of a simple -1

So, change:

PHP Code:

$rndid $rndgroups[rand(0,count($rndgroups) + 1) - 1]; 

to:

PHP Code:

$rndid $rndgroups[rand(0,count($rndgroups) + 1)]; 

and there should be no more problems.

I tested it no less than 5 times and was able to keep it working even with re-activating my image verification :)

bexie 11-14-2004 09:48 PM

EXACTLY what I need--is this possible for 2.3.5?

The Equivocate 12-10-2004 02:14 AM

Quote:

Originally Posted by ashkarita
Okay, since I'm wickedly impatient I decided to see about figuring this out on my own. After disabling virtually everything and still having the problem, I realized that the hack was rotating improperly and therefore throwing people into COPPA - problem is, they weren't IN the COPPA usergroup. The query had somehow created a NEW usergroup with no name and no id number that can't be modified. All as a result of a simple -1

So, change:

PHP Code:

$rndid $rndgroups[rand(0,count($rndgroups) + 1) - 1]; 

to:

PHP Code:

$rndid $rndgroups[rand(0,count($rndgroups) + 1)]; 

and there should be no more problems.

I tested it no less than 5 times and was able to keep it working even with re-activating my image verification :)

Doing that didn't solve the problem.

Andrew 12-10-2004 03:42 AM

PHP Code:

// RANDOM USERGROUP HACK by dstruct2k
// Replace "999" with the usergroupid's of your randomized groups.
// Add extra groups if required.

    
$rndgroups = array(
        
'10',
        
'11',
        
'13');

    if (
count($rndgroups) == 1)
    {
    
$newusergroupid $rndgroups[0];
    }
    else
    {
        
$rndid $rndgroups[rand(0,count($rndgroups) - 1)];

        
// assign user to group 3 if email needs verification
        
if ($vboptions['verifyemail'])
        {
            
$newusergroupid 3;
        }
        else
        {
            if (
$vboptions['moderatenewmembers'] OR $_POST['coppauser'])
            {
                
$newusergroupid 4;
            }
            else
            {
                
$newusergroupid $rndid;
            }
        }
    }

// END RANDOM USERGROUP HACK by dstruct2k 

Try that there - I've been creating new users for the last 30 minutes and it is working perfectly. I've tested with everything from 1 usergroup to 10 random ones and no errors. All I did was add an if statement that if there is only one automattically sets that as the group otherwise it randomly generates a group. I fixed the random part as well so it wouldn't throw out bad group numbers.

The Equivocate 12-10-2004 05:17 PM

Yep, your fix worked - thanks!

Andrew 12-10-2004 07:47 PM

Quote:

Originally Posted by The Equivocate
Yep, your fix worked - thanks!

No problem - Glad I could help out !

Wifey 12-13-2004 01:55 AM

I ended up having to change mine to -1 and it works perfectly now :) Sorry, I should have posted that a while back, but your problem is fixed so it really makes no difference how I fixed mine :p

edit: LMAO. And now I just looked at what the person after you posted that said and it's what I did. I'm so proud of myself, I figured it out on my own which is AMAZING considering how PHP illiterate I feel!

@ Bexie - hello Bex, darling. This was originally a vB2 hack, so yes, they have it for 2 - check the forums, I know it's there. If not I can find it for you because I know someone who uses it.

babolo 01-08-2005 07:14 PM

Quote:

Originally Posted by ashkarita
I ended up having to change mine to -1 and it works perfectly now :) Sorry, I should have posted that a while back, but your problem is fixed so it really makes no difference how I fixed mine :p

edit: LMAO. And now I just looked at what the person after you posted that said and it's what I did. I'm so proud of myself, I figured it out on my own which is AMAZING considering how PHP illiterate I feel!

@ Bexie - hello Bex, darling. This was originally a vB2 hack, so yes, they have it for 2 - check the forums, I know it's there. If not I can find it for you because I know someone who uses it.

Hey Ashley I finally found the hack you used. Anyways Ashkarita's technique work perfectly for me also. Hmm...

Dark Aura 04-08-2005 01:28 PM

Is this hack not supported if you have to moderate your members when they sign up?

I have tried all the different ways of doing this and nothing works :(

TrentHart 12-04-2005 06:00 PM

Does this hack work for 3.5 boards?

dcdub 12-16-2005 09:33 AM

Quote:

Originally Posted by TrentHart
Does this hack work for 3.5 boards?


Yea i was wondering the same thing

Senza 02-01-2006 01:54 AM

If this could work for moderating new registrations, that would be most excellent.

iHogwarts.com 04-21-2007 04:39 AM

OMG IT WORKS FOR vB3.6.5 with a few tweaks! THANK YOU SO MUCH!

/me clicks install.

Freak0204 05-22-2007 05:30 AM

Quote:

Originally Posted by iHogwarts.com (Post 1232441)
OMG IT WORKS FOR vB3.6.5 with a few tweaks! THANK YOU SO MUCH!

What kind of tweaks? Would like to use this myself.

teamsupra 07-24-2007 04:56 PM

Does anyone have this working on 3.6.x?


All times are GMT. The time now is 02:45 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.02646 seconds
  • Memory Usage 1,826KB
  • 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
  • (6)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (29)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete