MyBB Central

Full Version: Want Help in Registration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi.
I want Help with Registration Section. At my Site : http://www.xtreme-load.com User can register to forum with space in username . Like Under Takers. which i don't want. they need to Register their username without space. i dont' want to allow space in username, Can u help me out with coding. i can't take risk in coding.
Try this...please test it.

PHP Code:
<?php

/*
Plugin NoSpace Username
(c) 2006 by democracyforums.com Labrocca
Website: http://www.mybbcentral.com
*/

function nospace_username_info()
{
    return array(
        
"name"            => "NoSpace Usernames",
        
"description"    => "Prevents users registering with a space in username.",
        
"website"        => "http://www.democracyforums.com",
        
"author"        => "labrocca",
        
"authorsite"    => "http://www.mybbcentral.com",
        
"version"        => "1.0",
    );
}

$plugins->add_hook("member_do_register_start""nospace_username");


function 
nospace_username_activate()
{
}

function 
nospace_username_deactivate()
{
}

function 
nospace_username()
{
    global 
$mybb$session$db;
    if(
preg_match("\s",$mybb->input['username']))
        {
            
error("Sorry, you cannot register a username with spaces");
        }
}

?>
Hello labrocca,
But u didn't Tell me that it pluggin or something Else. Where I can add this code for test. thanks for your help.
Save the file as nospace_username.php and upload it to /inc/plugins/ then activate in admincp.
Hmm, i do the same but it's not working, i think. u didn't intialize where it check the loop for no space. can u check the code again .