Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Special character in Register page

+2 votes
asked 6 days ago in Q2A Core by Etka

users can take "ü,ö,ç, ? !" etc in ther nicknames but it really disgusting can we block that ?

thank you
Q2A version: Latest

1 Answer

+2 votes
answered 6 days ago by pupi1985
selected 6 days ago by Etka
Best answer

Yes. You can write a plugin to do so which includes a filter module. You'll want to focus on the filter_handle() method.

This method will almost make the whole plugin for you: https://github.com/q2a/question2answer/blob/4fce0eb2390f56b645dad375d1d81e9f91a97e69/qa-include/plugins/qa-filter-basic.php#L41 . Just copy/paste, remove the unneeded stuff and change the regular expression to whatever you want, which I get the impression should be something close to '/[^0-9a-zA-Z]/', based on your comments.

commented 6 days ago by Etka
edited 6 days ago by Etka
thank you for comment i try without plugin and i do somthing but it not work

    public function filter_handle(&$handle, $olduser)


        if (!strlen($handle)) {

            return qa_lang('users/handle_empty');


        if (in_array($handle, array('.', '..'))) {

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


        if (preg_match('/[\\@\\+\\/\\ç\\Ç\\Ö\\ö\\ş\\Ş/', $handle)) {

            return qa_lang_sub('users/handle_has_bad', '@ + / ç ş ö');


        if (qa_strlen($handle) > QA_DB_MAX_HANDLE_LENGTH) {

            return qa_lang_sub('main/max_length_x', QA_DB_MAX_HANDLE_LENGTH);



please can you more expain :D
commented 6 days ago by pupi1985
If you don't want to use a plugin you could just replace:




You could also replace '@ + /' with '' and change the corresponding language file for: users/handle_has_bad . That way the error could be 'Username can only contain characters from A to Z and numbers'.
commented 6 days ago by Etka
I can't manage this i do but it still don't effect to register screen
i look that later thx