To implement Wordpress filter in your module, you just need to add the filter definition of these filter in your main plugin file. Sample implementations are given below:
Note: These filters are supported from version >= 4.2.5
1: iflychat_get_username_filter - Assigns a username to a given user.
4: iflychat_get_user_roles_filter() - Assigns roles to a given user.
/** * Implements my_custom_get_user_roles(). * @params $roles associative array * @params $uid string */functionmy_custom_get_user_roles($roles,$uid){if($uid ===0){ $roles['sample-role-index-1'] ='Sample-Role-Name-1'; // users with odd user id have Sample-Role-1; }else{ $roles['sample-role-index-2'] ='Sample-Role-Name-2'; // users with even user id have Sample-Role-2; }return $roles;}add_filter('iflychat_get_user_roles_filter','my_custom_get_user_roles',10,2);
5: iflychat_get_user_groups_filter() - Assigns a group to a given user.
7: iflychat_check_access_filter() - Display chat to a limited set of users.
/** * Implements my_custom_filter(). * @params $access boolean * @params $uid string */functionmy_custom_filter($access,$uid) { $access =true;/** Get current user information **/global $current_user;get_currentuserinfo();/** Return $access as true or false based on your custom code */return $access;}add_filter('iflychat_check_access_filter','my_custom_filter',10,2);
For reference - https://developer.wordpress.org/reference/functions/add_filter/