MyBB Community Forums

Full Version: stopping signup from plugin *SOLVED*
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
*******************
***** SOLVED *******
*******************
The Full working Plugin is at Post #3 in
http://community.mybb.com/thread-118887.html
Enjoy


how would I go about thowing an error to the system to stop the signup I tried to call
$error[] = "some text";
&& 
error($lang->error_spam_deny);
like the lines below the hook dose (line 82 of members.php) but it dose not seem to stop the process, if you can help or point me to a post (I search but was not able to find).

using die() I traced the logic it works out the way it should but the error is not stopping the signup process.

here is the php

function check_user_in_game_name()
{
    GLOBAL $mybb;
    $check_user_in_game_DB_location     = "xxxx";
    $check_user_in_game_DB_user_name    = "xxx";
    $check_user_in_game_DB_user_pass    = "xxxx";
    $check_user_in_game_DB_name         = "xxx";
    $check_user_in_game_DB_table        = "xxx";

    $conUserName = mysql_connect($check_user_in_game_DB_location,$check_user_in_game_DB_user_name,$check_user_in_game_DB_user_pass)or die("error 1");
    mysql_select_db($check_user_in_game_DB_name, $conUserName);
    $checkUserNameCall = "SELECT playername FROM `".$check_user_in_game_DB_table."` WHERE playername = '".mysql_real_escape_string($mybb->input['username'])."' LIMIT 1";
    $checkUserNameResult = mysql_query($checkUserNameCall,$conUserName)or die("error 2 ".mysql_error());// $errors[] = "Oh, snap! Something went wrong if HordeCraft Member. dang!";

	if($checkUserNameResult && mysql_num_rows($checkUserNameResult) > 0)
	{
	    mysql_close($conUserName);
	    error($lang->error_spam_deny);
	    $errors[] = "Not A HordeCraft Member.";
	    return false;
	} elseif(!$checkUserNameResult){
	   error($lang->error_spam_deny);
           $errors[] = "Unable to check your players Status. Please contant an site admin.";
	    return false;
    }
	mysql_close($conUserName);
	return true;
}

going over the member.php file I see that
 $error 
is set to null after the hook is called is its out but I don't see a way to kill the signup in member.php

Any help would be great, Thanks.
at minimum, you need to add $errors to the global list next to $mybb
Thanks, I did that and still no errors a sent line 161 of member has
$errors = "";
resetting the var before it is checked at line 183.
so it looks like any input is over-written

(2012-05-16, 04:10 PM)pavemen Wrote: [ -> ]at minimum, you need to add $errors to the global list next to $mybb
what hook are you using?
member_do_register_start
called on line 82 of member.php, would there be a better (looking at the list this made the most seance to me but if there is a better?)
I thought about "member_do_register_end" but it looks like it is called after the new user is already in the DB and a email is sent to the admin.
(2012-05-16, 04:25 PM)pavemen Wrote: [ -> ]what hook are you using?
use datahandler_user_validate in /inc/datahandlers/user.php
+1 Rep - Thank that did it. Amazing what the right hook does Thanks.

BTW is there some way to mark as Solved? I don't see one, but. I did'nt see that hook ether.

(2012-05-16, 04:45 PM)pavemen Wrote: [ -> ]use datahandler_user_validate in /inc/datahandlers/user.php
this particular forum does not run MySupport, so no way to mark as solved other than editing the subject of your OP