BBP_Users_Admin::user_role_bulk_dropdown( string $which )
Add bulk forums role dropdown to the WordPress users table
Description Description
Parameters Parameters
- $which
-
(Required) The location of the extra table nav markup: 'top' or 'bottom'.
Source Source
File: includes/admin/users.php
public static function user_role_bulk_dropdown( $which ) { // Remove the bottom list table "change forum role" dropdown from WordPress < 4.6. // See https://bbpress.trac.wordpress.org/ticket/2906. if ( bbp_get_major_wp_version() < 4.6 ) { remove_action( 'restrict_manage_users', array( __CLASS__, 'user_role_bulk_dropdown' ) ); } // Bail if current user cannot promote users if ( ! current_user_can( 'promote_users' ) ) { return; } // Get the roles $dynamic_roles = bbp_get_dynamic_roles(); // Only keymasters can set other keymasters if ( ! bbp_is_user_keymaster() ) { unset( $dynamic_roles[ bbp_get_keymaster_role() ] ); } $select_id = 'bottom' === $which ? 'bbp-new-role2' : 'bbp-new-role'; $button_id = 'bottom' === $which ? 'bbp-change-role2' : 'bbp-change-role'; ?> <label class="screen-reader-text" for="<?php echo $select_id; ?>"><?php esc_html_e( 'Change forum role to…', 'bbpress' ) ?></label> <select name="<?php echo $select_id; ?>" id="<?php echo $select_id; ?>" style="display:inline-block; float:none;"> <option value=''><?php esc_html_e( 'Change forum role to…', 'bbpress' ) ?></option> <?php foreach ( $dynamic_roles as $role => $details ) : ?> <option value="<?php echo esc_attr( $role ); ?>"><?php echo bbp_translate_user_role( $details['name'] ); ?></option> <?php endforeach; ?> </select><?php submit_button( esc_html__( 'Change', 'bbpress' ), 'secondary', $button_id, false ); wp_nonce_field( 'bbp-bulk-users', 'bbp-bulk-users-nonce' ); }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | bbPress (r6055) Introduced the $which parameter. |
2.2.0 | Introduced. |