WordPress: Modifying the data sent to the chat by the plug-in

You are here:

The RumbleTalk WordPress plug-in is using the WP apply_filters function with the “rumbletalk_login_args” tag.

This means you can add filters using the WP add_filter function to modify the data sent to your RumbleTalk chat when automatically logging users into your chat.

You do so by adding a filter like this:

add_filter(‘rumbletalk_login_args’, ‘your_callback’);

Where ‘your_callback’ is the name of your modifying function.

e.g.

function your_callback($loginInfo) {
  $loginInfo[‘username’] = ‘My Site: ‘ . $loginInfo[‘username’];
  return $loginInfo;
}

This example will prefix your user names with the string “My Site: “
e.g. for the user “Joe”, the username “My Site: Joe” will be passed.

Currently, you can modify the following items:

  • username – string: the username (fetched using the WP function wp_get_current_user and get_the_author_meta)
  • password – string: defaults to being empty but can be set to the chat user’s RumbleTalk password for a more secure integration where the guest login option is disabled
  • forceLogin – boolean: whether or not to execute a logout function before the log in function (this can also be configured in the plug-in settings page)
  • image – string: the user’s avatar (defaults to the users WP avatar fetched using the WP function get_avatar_url)
  • hash – string: the room your user is logging into (you most likely should not modify this value)

For more information, refer to our WP plug-in.

See the includes/class-rumbletalk.php file for the full process.

Share Button

Categories