} ?> <?php } ?> </tr> </thead> <tfoot> <tr> <th class="checkbox-only"></th> <th></th> <?php foreach ($all_roles as $role) { ?> <th><?php echo CUAR_WordPressHelper::getRoleDisplayName($role->name); ?> </th> <?php } ?> </tr> </tfoot> <tbody> <?php foreach ($section['groups'] as $group) { $group_name = $group['group_name']; $group_caps = $group['capabilities']; if (empty($group_caps)) { continue; }
/** * Output a select field for a setting * * @param string $option_id * @param array $options * @param string $caption */ public function print_role_select_field($args) { extract($args); if (isset($before)) { echo $before; } echo sprintf('<select id="%s" name="%s[%s]">', esc_attr($option_id), self::$OPTIONS_GROUP, esc_attr($option_id)); global $wp_roles; if (!isset($wp_roles)) { $wp_roles = new WP_Roles(); } $all_roles = $wp_roles->role_objects; if ($show_any_option) { $value = 'cuar_any'; $label = __('Any Role', 'cuar'); $selected = $this->options[$option_id] == $value ? 'selected="selected"' : ''; echo sprintf('<option value="%s" %s>%s</option>', esc_attr($value), $selected, $label); } foreach ($all_roles as $role) { $value = $role->name; $label = CUAR_WordPressHelper::getRoleDisplayName($role->name); $selected = $this->options[$option_id] == $value ? 'selected="selected"' : ''; echo sprintf('<option value="%s" %s>%s</option>', esc_attr($value), $selected, $label); } echo '</select>'; if (isset($after)) { echo $after; } }