Wordpress Chinese user name login (user name cannot use Chinese)

Source: Internet
Author: User
Tags wordpress blog


Wordpress cannot register a Chinese user name


We can make the following changes to allow wordpress to log on with a Chinese user name:

1. Open the wp-uplodes/formatting. Php file.

2. Find

Function sanitize_user ($ username, $ strict = false) {3. Add

$ Strict = false; this function can be implemented through a simple trilogy. The principle is also very simple. Force $ strict = false, in this way, wordpress does not strictly process the user name characters when registering or modifying the user name, and the Chinese user name can be used normally.

 

1. Security question: If any string can be registered as a user name, will it pose a threat to your website?
2. coverage after upgrade: If you upgrade wordpress, wp-nodes des/formatting. the PHP file will be overwritten by the upgrade file. You need to modify it again. Otherwise, new users may no longer be able to use the Chinese user name, the original Chinese user name may also encounter problems such as information modification and logon.

Another solution


By default, a wordpress blog does not support registering a Chinese user name. Whether you register a user at the front-end or you add a Chinese user in the background, the user will prompt "this user name contains invalid characters ". To solve this problem, you can modify the code or use the plug-in.

Modify the code to open the formatting. Php file under the wp-uplodes Directory, search for "function sanitize_user ($ username, $ strict = false)", and add the code "$ strict = false;" under it ;"
Function sanitize_user ($ username, $ strict = false)
{
$ Strict = false; // solve the problem that the Chinese user name cannot be registered
$ Raw_username = $ username;
$ Username = wp_strip_all_tags ($ username );
$ Username = remove_accents ($ username );
}

The disadvantage of modifying the code to solve the problem is that you need to perform the operation again after each WordPress upgrade.

Now we can implement Chinese login.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.