Support » Plugins » Display nickname instead of username in comments…

  • Resolved jlaw


    Hi all,
    I am working on a chinese version of WordPress. Everything was working great until I found out chinese username is not supported. It was important to show chinese username because many chinese users prefer to be identified by their chinese monikers in either their posts or comments. I was trying to hack WP functions, like santize_user. But after looking at the code, I dont think it was a good idea to change any WP core functions because it is obvious WP is not built to be fully UTF8 compatible. I understand there are issues like portability. So to make things simple for myself, I now decide to use nickname as the author name because users can input chinese in the nickname field. I hope u guys can help me out here. I need to find out how I can modify “comments.php” to display nickname for comments. I know it is an easy job to display nickname for posts.

    Million thanks in advance!

Viewing 1 replies (of 1 total)
  • Hi all,
    I have resolved the problem myself. But I still didnt manage to display nickname in place of username. Instead, I modified the registration functions to where it allows username in unicode. The 2 functions that I modified are validate_username and wp_insert_user, both are in “registration-functions.php. It was lazy workaround, I know. I simply changed the 2nd parameter in a function called “sanitize_user” to “false”. The sanitize function removes any invalid characters or codes in username string. If u enters a username like “中国ABC”, the sanitize function will reduce the string to only “ABC”. I hope this is helpful for those are interested in enabling unicode in username.

    ******************W A R N I N G S**************************
    But there will be some side effects because you will need to encode unicode username if u need to incorporate username in URL. For example,中国ABC is impossible. Just a reminder.

Viewing 1 replies (of 1 total)
  • The topic ‘Display nickname instead of username in comments…’ is closed to new replies.