ajax loader

Show nickname instead of full username

Home Forums WpChats SupportShow nickname instead of full username

This topic contains 1 reply, has 2 voices, and was last updated by  samuel 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #614

    Really enjoying this plugin, lots of great features!!

    One thing I’m trying to achieve is instead of showing the users full name is it possible to show their nice name?

    Thanks

    #618

    Dear Aaron,

    Sorry about the delay here. I didn’t prepare WpChats quite well for filters so you will need to do modify 1 of the core files to add a filter:

    – Go to your-site.com/wp-admin/plugin-editor.php?file=wpchats/includes/core/functions.php (replace your-site.com with your own domain) and remove all the existing code and paste this code in instead http://pastebin.com/WfvskwXy, then save. (or you can do it with file manager or ftp, the file is at wp-content/plugins/wpchats/includes/core/functions.php)

    Once you’ve done that, add the following code to your child theme’s functions file (or via a custom plugin):

    add_filter('wpc_get_user_name', function($name, $user_id){
        return get_userdata($user_id)->nickname;
    }, 10, 2);

    Let me know how it goes. Thank you!

    Best,

    Samuel // Contact MeWork With Me

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.