notices
5 years ago
admin-bar.php
7 years ago
admin-tab-advanced.php
7 years ago
admin-tab-logs.php
5 years ago
admin-tab-main.php
7 years ago
admin-tab-plugins.php
5 years ago
admin-tab-themes.php
5 years ago
advanced-premium-preview.php
7 years ago
advanced-premium.php
5 years ago
exclude-users.php
5 years ago
force-updates.php
5 years ago
reset-options.php
5 years ago
exclude-users.php
41 lines
| 1 | <?php |
| 2 | if (!defined('ABSPATH')) die('No direct access.'); |
| 3 | |
| 4 | echo '<div class="eum-advanced-settings-container exclude-users" style="display: block;">'; |
| 5 | printf('<h3>%s</h3>', esc_html__('Exclude users', 'stops-core-theme-and-plugin-updates')); |
| 6 | printf('<p>%s</p>', esc_html__('Select users who will be forbidden to access the settings of this plugin.', 'stops-core-theme-and-plugin-updates')); |
| 7 | printf('<p>%s</p>', esc_html__('This option is useful if, for example, you would like to disable updates, but have a user account that can still update WordPress.', 'stops-core-theme-and-plugin-updates')); |
| 8 | printf('<p><strong>%s</strong></p>', esc_html__('Users to be forbidden', 'stops-core-theme-and-plugin-updates')); |
| 9 | |
| 10 | // Code from wp-admin/includes/class-wp-ms-users-list-table |
| 11 | $users = array(); |
| 12 | if (is_multisite()) { |
| 13 | global $wpdb; |
| 14 | $logins = implode("', '", get_super_admins()); |
| 15 | $users = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins') GROUP BY user_login"); |
| 16 | } else { |
| 17 | /** |
| 18 | * Determine which role gets queried for admin users. |
| 19 | * |
| 20 | * Determine which role gets queried for admin users. |
| 21 | * |
| 22 | * @since 5.0.0 |
| 23 | * |
| 24 | * @param string $var administrator. |
| 25 | */ |
| 26 | $role = apply_filters('mpsum_admin_role', 'administrator'); |
| 27 | $users = get_users(array('role' => $role, 'orderby' => 'display_name', 'order' => 'ASC', 'fields' => 'ID')); |
| 28 | } |
| 29 | if (is_array($users) && !empty($users)) { |
| 30 | echo '<input type="hidden" value="0" name="mpsum_excluded_users[]" />'; |
| 31 | $options = MPSUM_Updates_Manager::get_options('advanced'); |
| 32 | $excluded_users = isset($options['excluded_users']) ? $options['excluded_users'] : array(); |
| 33 | foreach ($users as $index => $user_id) { |
| 34 | $user = get_userdata($user_id); |
| 35 | $disabled = get_current_user_id() === absint($user_id) ? 'disabled="true"' : ''; |
| 36 | printf('<input type="checkbox" name="mpsum_excluded_users[]" id="mpsum_user_%1$d" value="%1$d" %3$s %4$s /> <label for="mpsum_user_%1$d">%2$s</label><br />', esc_attr($user_id), esc_html($user->display_name), checked(true, in_array($user_id, $excluded_users), false), $disabled); |
| 37 | } |
| 38 | } |
| 39 | printf('<p class="submit"><input type="submit" name="submit" id="save-excluded-users" class="button button-primary" value="%s"></p>', esc_attr__('Save users', 'stops-core-theme-and-plugin-updates')); |
| 40 | echo '</div>'; |
| 41 |