/** * 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 }
/** * Adds a forum roles dropdown above the users table. * * @since 1.0.0 * @access public * @return void */ public function roles_dropdown() { if (current_user_can('promote_users')) { ?> <label class="screen-reader-text" for="mb_new_forum_role"> <?php _e('Change forum role to…', 'message-board'); ?> </label> <?php mb_dropdown_roles(array('show_option_none' => __('Change forum role…', 'message-board'), 'exclude' => mb_is_user_keymaster(get_current_user_id()) ? array() : array(mb_get_keymaster_role()))); ?> <?php submit_button(__('Change', 'message-board'), 'button', 'mb_change_role', false); ?> <?php } }