vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Special link invite, when user joins is automatic dropped into usergroup # (https://vborg.vbsupport.ru/showthread.php?t=203613)

Vaupell 01-30-2009 02:05 PM

Special link invite, when user joins is automatic dropped into usergroup #
 
Setting :

Make a campagn for promotion of your site!
In that campaign there is a invitation code or link

When a user clicks that and is ofcourse directed to your site's register page
when the potential user is done registering, the user is automatic put in a
specifik Usergroup, instead of where the other normal registrations go.

Other :

Ive seen this discussed before, but i cant located or find if its a mod
allready existing, but that could be quite usefull, also for the gameing
community, would like to know the difference between random registrants
and "known" so make that promotion link availible to frinds/clan buddys
or in a campagin, and this will auto sort users in those specifik groups..

okay,, what do you guys think.
Im sure its quite complicated, and im nothing more than a scriptkiddie,
hmm more like script adult, anyway the case is i have noway atm
of completing or starting such a project.

:):up:

Vaupell 02-02-2009 08:14 PM

okay, guess noone could use this..

does anyone know, would it be possible to make a duplicate registration
form, and simply edit it to fit whats needed.

removed alot, but most importent added 1 item
the invitation code that is checked against a reference preferable in db
then dropping the user in a usergroup for that code..

exsample
user : tom, registrates with the invitation code "offer31"

if invitation code = true
add user to usergroup = "special group
else
add user to usergroup = "normal :p
/if

Ted S 02-02-2009 09:31 PM

This addon actually isn't that hard...

If you work with a new plugin for the hook register_addmember_process (or just find this in register.php) you'll basically need to add to get the invite code, check it and update the group.

This code will preform a basic check and move a user, you'll have to get a bit more advanced if you want to compare codes against a database table.

Code:

// parse the form field
$vbulletin->input->clean_gpc('r', 'invitecode', TYPE_NOHTML);
// check if they entered the code "secret code"
if ($vbulletin->GPC['invitecode'] == 'Secret Code'){
 $userdata->set('usergroupid', '5'); // change the usergroup from 5 to whatever
}

Playing around with the code you can do other things like send a special email out, show a different thank you message and so forth.

Vaupell 02-02-2009 11:23 PM

Quote:

Originally Posted by Ted S (Post 1732399)
This addon actually isn't that hard...

If you work with a new plugin for the hook register_addmember_process (or just find this in register.php) you'll basically need to add to get the invite code, check it and update the group.

This code will preform a basic check and move a user, you'll have to get a bit more advanced if you want to compare codes against a database table.

Code:

// parse the form field
$vbulletin->input->clean_gpc('r', 'invitecode', TYPE_NOHTML);
// check if they entered the code "secret code"
if ($vbulletin->GPC['invitecode'] == 'Secret Code'){
 $userdata->set('usergroupid', '5'); // change the usergroup from 5 to whatever
}

Playing around with the code you can do other things like send a special email out, show a different thank you message and so forth.


Thank you so much for this codebit,, it works like a charm
running it on a local test board, and its impressive... LOVELy..

any tips on where i can read up on importing data from the database ?
and saveing to the db using php, was thinking maybe making a admin control to
set usergroup and invitation code ;)

Ted S 02-03-2009 12:29 AM

I love it when people take iniative! It makes everyone so much more willing to help you along.

Databases are actually pretty simple when used for a straight compare... A query for your code could read something like:

Code:

$vbulletin->input->clean_gpc('r', 'invitecode', TYPE_NOHTML);
 
 
if($vbulletin->GPC['invitecode']){
 $invitegroupid = $db->query_first_slave("
 SELECT usergroupid
 FROM " . TABLE_PREFIX . "invitecodes
 WHERE invite = " . $db->escape_string($vbulletin->GPC['invitecode']))
 
 if($invitegroupid){
 
  $userdata->set('usergroupid', $invitegroupid);
 
 } else {
 
  // no group found, bad code!
  echo "no group found, try another code next time";
 
 }
 
}

With this code you would just need a simple table with the fields invite,usergroupid which you could create through a program like phpmyadmin. Again the sky is the limit and you may want to add more things but this should help you trudge along.

As far as adding an admin page that too is pretty straight forward. I'd suggest looking at the code in one of the more basic admin areas like Paid Memberships to see how it calls up the existing records and prints them out.

Vaupell 02-03-2009 07:28 AM

Quote:

With this code you would just need a simple table with the fields invite,usergroupid which you could create through a program like phpmyadmin. Again the sky is the limit and you may want to add more things but this should help you trudge along.

As far as adding an admin page that too is pretty straight forward. I'd suggest looking at the code in one of the more basic admin areas like Paid Memberships to see how it calls up the existing records and prints them out.
awn... . just got out of bed.

Tx again ted, well this code snippet is excaktly what i needed
gonna modify it a little, but excaktly whats missing to move bump me along..

got the templaate edits working
got the plugins for phrases + registration modifications working

should get that working today ;)

todo :
- admin panel where admin can see which invitation codes run + usergroupid's
view,edit,save,delete,add

well aparently this is gonna turn into a mod thanks to Ted S.

--------------- Added [DATE]1233657299[/DATE] at [TIME]1233657299[/TIME] ---------------

FROM " . TABLE_PREFIX . "

isent something to change correct ?
thats the prefix admin sets when seting up board correct ?
trying to debug, cause getting a parse error...

Ted S 02-03-2009 03:31 PM

No that's not something you need to change, that will automatically call in your table prefix if you have one.

What was the parse error?

Vaupell 02-03-2009 03:36 PM

ahh yes, went along the process now...

currently stuck in a parse error execution side..
https://vborg.vbsupport.ru/showthread.php?t=204054

so went to complete the admincp

- add new code (complete)
- delete code ( complete)

- edit page.. kinda stuck atm.. :p '
https://vborg.vbsupport.ru/showthread.php?t=204084

- database installation (complete)
- database uninstallation table drops (complete)

so only missing that if statement to work proberly before im gonna
upload it to a live server for prober testing ;)

The Edit codeCP is a minor issue, no need really just nice to have..

EDIT : only 60% phrases done. :p

knoffs 02-04-2009 01:02 PM

thats a great plugin-idea, i am looking forward to the first test of the mod

Vaupell 02-04-2009 02:20 PM

Quote:

Originally Posted by knoffs (Post 1734193)
thats a great plugin-idea, i am looking forward to the first test of the mod

im actually done.. only missing to get that last If statement working..

AdminCP - 95% done; add+del works, edit fails atm.
Phrases - Done
Database - Done
Templates - Done
File edits - Done

And it works. only one task left before release,
I works fine and as intended on a board that does not require Email verification
but boards that DO require email verification it fails, the usergroup ID gets lost
dureing the board (invitation.php) -> mail -> board (register.php)


All times are GMT. The time now is 07:20 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.01165 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
  • (3)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete