user-role.php
31 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Users roles section under the "analytics" tab. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.2.0 |
| 7 | */ |
| 8 | |
| 9 | global $wp_roles; |
| 10 | $roles = Opt_In_Utils::get_user_roles(); |
| 11 | $admin_roles = array(); |
| 12 | ?> |
| 13 | |
| 14 | <div class="sui-box-settings-row"> |
| 15 | |
| 16 | <div class="sui-box-settings-col-1"> |
| 17 | <span class="sui-settings-label"><?php esc_html_e( 'User Role', 'hustle' ); ?></span> |
| 18 | <span class="sui-description"><?php esc_html_e( 'Choose the user roles you want to make the analytics widget available to.', 'hustle' ); ?></span> |
| 19 | </div> |
| 20 | |
| 21 | <div class="sui-box-settings-col-2"> |
| 22 | <select class="sui-select" name="role[]" multiple> |
| 23 | <?php foreach ( $roles as $slug => $label ) { ?> |
| 24 | <?php $admin = Opt_In_Utils::is_admin_role( $slug ); ?> |
| 25 | <option value="<?php echo esc_attr( $slug ); ?>" <?php selected( in_array( $slug, $value, true ) || $admin ); ?> <?php disabled( $admin ); ?> ><?php echo esc_html( $label ); ?></option> |
| 26 | <?php } ?> |
| 27 | </select> |
| 28 | </div> |
| 29 | |
| 30 | </div> |
| 31 |