Chat username for users

You can easily change the displaying name of the user in our chat using the code below.

Example of the path to the file for SweetDate:

\wp-content\themes\sweetdate\functions.php

The feature code:

add_filter('rest_imbachat_get_user_name_query', function ($argument, $params){

    $user_id = $params['id'];

    /////////////////////
    ///
    /// Here you can use any code to change the user name
    ///
    /////////////////////

    return $params['name'];
}, 10, 3);