/** * Filter on the `request` hook to change what posts are loaded. * * @since 1.0.0 * @access public * @param object $user * @return void */ public function profile_fields($user) { if (!current_user_can('promote_users') || !current_user_can('edit_user', $user->ID)) { return; } $role = mb_get_user_role($user->ID); ?> <h3><?php _e('Forum', 'message-board'); ?> </h3> <table class="form-table"> <tr> <th><label for="mb_forum_role"><?php _e('Forum Role', 'message-board'); ?> </label></th> <td> <?php mb_dropdown_roles(array('selected' => $role ? $role : mb_get_default_role(), 'exclude' => mb_is_user_keymaster(get_current_user_id()) ? array() : array(mb_get_keymaster_role()))); ?> </td> </tr> </table> <?php }
/** * Maps default WordPress roles to the plugin's roles. This is the default used when a user doesn't yet * have a forum role. Developers can add custom-created roles to the map using a filter on the * `mb_get_role_map` hook. Roles are mapped in key/value pairs. The key is the WP or custom role. The * value is the forum role to map it to. * * @since 1.0.0 * @access public * @return array */ function mb_get_role_map() { $default_role = mb_get_default_role(); $mapped = array('administrator' => mb_get_keymaster_role(), 'editor' => $default_role, 'author' => $default_role, 'contributor' => $default_role, 'subscriber' => $default_role); return apply_filters('mb_get_role_map', $mapped, $default_role); }