AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Solved] Is there no character limit for usernames during registration?

3 Posts
2 Users
0 Reactions
251 Views
Posts: 23
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@plaka37)
Eminent Member
Joined: 3 months ago
[#72666]

Is there no character limit for usernames during registration? I tried 40 characters and it registered. Probably even more. This is a big problem. I think it's possible to register with a 100-character username.


2 Replies
Sofy
Posts: 5776
 Sofy
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@sofy)
Support Team
Joined: 8 years ago

Hi,

User registration and account creation are part of the WordPress core. wpForo only provides the registration form with different design and URL.

This is a native WordPress function, so you should look for a solution in WordPress itself.

Try searching for something like: “limit username in WordPress registration”.


Posts: 23
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@plaka37)
Eminent Member
Joined: 3 months ago

I solved the problem. 

 

The limit is set to a minimum of 3 and a maximum of 15 characters. You can change this if you wish. Add this to the functions file:

 

add_filter('registration_errors', function ($errors, $sanitized_user_login, $user_email) {

$length = mb_strlen($sanitized_user_login, 'UTF-8');

if ($length < 3 || $length > 15) {
$errors->add(
'username_length_error',
'Kullanıcı adı 3 ile 15 karakter arasında olmalıdır.'
);
}

return $errors;

}, 10, 3);

Share: