Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+9 votes
864 views
in Q2A Core by

2 Answers

+1 vote
by
edited by
 
Best answer

Adding this snippet of code at qa-include/pages/register.php:90 is enough.

if (strpos(trim($inhandle),' ')) {

$qa_content=qa_content_prepare();

$qa_content['error'] ="Spaces are not allowed in username!";

return $qa_content;

}

Edit: To prevent username from being changed after register, you may use this code at qa-include/pages/account.php after 92 line.

if (strpos(trim($inhandle),' ')) { $errors['handle']="Spaces are not allowed in username!"; }

by
Answer has been updated..Take a look!
by
Or you can simply just  modify the filter_handle function found in /qa-include/plugins/qa-filter-basic.php . This will work in every case.
by
@teddydoors And what's the code/ how to modify?
by
Lol...The q2a core does the same thing you did..First, understand the question and then comment..He meant that there would be no space in the handle..And your code makes no sense,
+4 votes
by

Add this code at qa-include/plugins/qa-filter-basic.php:51

if (preg_match('/\\s/', $handle)) {

    return qa_lang_sub('users/handle_has_bad', 'space');

}

...