Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-31-2012, 05:30 PM
minifisch minifisch is offline
 
Join Date: Jun 2011
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Hooking into registration process. Check for validity

Hey guys!

I'm the owner of an upcoming german Minecraft community and I'm the web developer for our main site, running on the newest vBulletin 4.
My problem explained:
I need to check a custom field (field5, MC-Account) for validity with the following url (http://www.minecraft.net/haspaid.jsp?user=minifisch") - if the answer from the request ist true, the registration is complete. If the answer from the minecraft.net site is false, the user cant register and some error message is showing up.

So, my question is:
Is there a documentation about the registration process? I'm very new to PHP and its very difficult for me to learn new script languages.

Can someone help me with my "minecraft-user-validation" code?
Reply With Quote
  #2  
Old 07-31-2012, 11:02 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There isn't much in the way of detailed documentation. You can look in the article section for somethign related to registration, but the best way (IMHO) is to look at register.php and see what's going on.

In your case, I think you could create a plugin using hook register_addmember_process and something like this:

Code:
if (!empty($vbulletin->GPC['userfield']['field5']))
{
    $url = 'http://www.xminecraft.net/haspaid.jsp?user=' . urlencode($vbulletin->GPC['userfield']['field5']);
    $reply = @file_get_contents($url);
    if ($reply === 'false')
    {
        // hasn't paid
        eval(standard_error(fetch_error('not_paid', $vbulletin->GPC['userfield']['field7'])));
    }
    else if ($reply !== 'true')
    {
        // couldn't complete check (site is down or whatever)
        eval(standard_error(fetch_error('check_failed')));
    }
}

and then you'd have to create the phrases 'not_paid' and 'check_failed' (you can chnage those varnames to whatever you want, of course).
Reply With Quote
  #3  
Old 08-04-2012, 04:28 PM
minifisch minifisch is offline
 
Join Date: Jun 2011
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*Looking for any kind of thank button :3*

Thank you very much! This help us alot from preventing trolls und fakers.
Now, there is only one thing left to check for:
field5 should be unique in our database, if any one have already the same content in field5 (MC-User) there should show up a message like: "The Minecraft.net account is already in use by: <nameofuser>"

Edit:
Got it to work, now there is another problem:
Could not find phrase 'account_in_use'.

Phrase "account_in_use" is created and filled with text.
Reply With Quote
  #4  
Old 08-05-2012, 12:34 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by minifisch View Post
Now, there is only one thing left to check for:
field5 should be unique in our database, if any one have already the same content in field5 (MC-User) there should show up a message like: "The Minecraft.net account is already in use by: <nameofuser>"
Maybe something like (goes just inside the first 'if':

Code:
$result = $vbulletin->db->query_first("SELECT userid FROM " . TABLE_PREFIX . "userfield WHERE field5='" . $vbulletin->db->escape_string($vbulletin->GPC['userfield']['field5']) . "' LIMIT 1");
if ($result)
{
    eval(standard_error(fetch_error('account_in_use')));
}
Quote:
Got it to work, now there is another problem:
Could not find phrase 'account_in_use'.

Phrase "account_in_use" is created and filled with text.
What phrase type did you make that phrase? It has to be one that's loaded for that page.
Reply With Quote
  #5  
Old 08-05-2012, 01:13 AM
minifisch minifisch is offline
 
Join Date: Jun 2011
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried it with type GLOBAL and type "Benutzeroberfl?che: Registrierung" - userinterface: register

I have set up the field text and the transation field for german.
Still showing me that he cant find the correct phrases.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:01 PM.


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.05010 seconds
  • Memory Usage 2,197KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete