/** * Add our capabilities to our own group in the members plugin * * @since 1.6 * @access public * @see init() */ public function members_register_cap_group() { if (function_exists('members_register_cap_group')) { // Register the vaa group. members_register_cap_group('view_admin_as', array('label' => esc_html__('View Admin As', 'view-admin-as'), 'caps' => $this->add_capabilities(), 'icon' => 'dashicons-visibility', 'diff_added' => true)); } }
/** * Add GravityView group to Members 1.x plugin management screen * @see members_register_cap_group() * @since 1.15 * @return void */ function members_register_cap_group() { if (function_exists('members_register_cap_group')) { $args = array('label' => __('GravityView', 'gravityview'), 'icon' => 'gv-icon-astronaut-head', 'caps' => self::all_caps(), 'merge_added' => true, 'diff_added' => false); members_register_cap_group('gravityview', $args); } }
/** * Registers the default cap groups. * * @since 1.0.0 * @access public * @return void */ function members_register_cap_groups() { // Register the all group. members_register_cap_group('all', array('label' => esc_html__('All', 'members'), 'caps' => members_get_all_group_caps(), 'icon' => 'dashicons-plus', 'merge_added' => false)); // Registers the general group. members_register_cap_group('general', array('label' => esc_html__('General', 'members'), 'caps' => members_get_general_group_caps(), 'icon' => 'dashicons-wordpress')); // Loop through every custom post type. foreach (get_post_types(array(), 'objects') as $type) { // Skip revisions and nave menu items. if (in_array($type->name, array('revision', 'nav_menu_item'))) { continue; } // Get the caps for the post type. $has_caps = members_get_post_type_group_caps($type->name); // Skip if the post type doesn't have caps. if (empty($has_caps)) { continue; } // Set the default post type icon. $icon = $type->hierarchical ? 'dashicons-admin-page' : 'dashicons-admin-post'; // Get the post type icon. if (is_string($type->menu_icon) && preg_match('/dashicons-/i', $type->menu_icon)) { $icon = $type->menu_icon; } else { if ('attachment' === $type->name) { $icon = 'dashicons-admin-media'; } else { if ('download' === $type->name) { $icon = 'dashicons-download'; } else { if ('product' === $type->name) { $icon = 'dashicons-cart'; } } } } // Register the post type cap group. members_register_cap_group("type-{$type->name}", array('label' => $type->labels->name, 'caps' => $has_caps, 'icon' => $icon)); } // Register the taxonomy group. members_register_cap_group('taxonomy', array('label' => esc_html__('Taxonomies', 'members'), 'caps' => members_get_taxonomy_group_caps(), 'icon' => 'dashicons-tag', 'diff_added' => true)); // Register the theme group. members_register_cap_group('theme', array('label' => esc_html__('Appearance', 'members'), 'caps' => members_get_theme_group_caps(), 'icon' => 'dashicons-admin-appearance')); // Register the plugin group. members_register_cap_group('plugin', array('label' => esc_html__('Plugins', 'members'), 'caps' => members_get_plugin_group_caps(), 'icon' => 'dashicons-admin-plugins')); // Register the user group. members_register_cap_group('user', array('label' => esc_html__('Users', 'members'), 'caps' => members_get_user_group_caps(), 'icon' => 'dashicons-admin-users')); // Register the custom group. members_register_cap_group('custom', array('label' => esc_html__('Custom', 'members'), 'caps' => members_get_capabilities(), 'icon' => 'dashicons-admin-generic', 'diff_added' => true)); // Hook for registering cap groups. Plugins should always register on this hook. do_action('members_register_cap_groups'); // Check if the `all` group is registered. if (members_cap_group_exists('all')) { // Set up an empty caps array and get the `all` group object. $caps = array(); $_group = members_get_cap_group('all'); // Get the caps from every registered group. foreach (members_get_cap_groups() as $group) { $caps = array_merge($caps, $group->caps); } // Sort the caps alphabetically. asort($caps); // Assign all caps to the `all` group. $_group->caps = array_unique($caps); } // Check if the `custom` group is registered and there's possibly other non-default groups. if (has_action('members_register_cap_groups') && members_cap_group_exists('custom')) { // Get the custom group object. $custom = members_cap_group_factory()->groups['custom']; // Unset the custom group object. unset(members_cap_group_factory()->groups['custom']); // Move the custom group object to the end. members_cap_group_factory()->groups['custom'] = $custom; } }
/** * Registers the default cap groups. * * @since 1.0.0 * @access public * @return void */ function members_register_cap_groups() { // Register the all group. members_register_cap_group('all', array('label' => esc_html__('All', 'members'), 'caps' => members_get_all_group_caps(), 'icon' => 'dashicons-plus', 'merge_added' => false)); // Registers the general group. members_register_cap_group('general', array('label' => esc_html__('General', 'members'), 'caps' => members_get_general_group_caps(), 'icon' => 'dashicons-wordpress')); // Loop through every custom post type. foreach (get_post_types(array(), 'objects') as $type) { // Skip revisions and nave menu items. if (in_array($type->name, array('revision', 'nav_menu_item'))) { continue; } // Get the caps for the post type. $has_caps = members_get_post_type_group_caps($type->name); // Skip if the post type doesn't have caps. if (empty($has_caps)) { continue; } // Set the default post type icon. $icon = $type->hierarchical ? 'dashicons-admin-page' : 'dashicons-admin-post'; // Get the post type icon. if (is_string($type->menu_icon) && preg_match('/dashicons-/i', $type->menu_icon)) { $icon = $type->menu_icon; } else { if ('attachment' === $type->name) { $icon = 'dashicons-admin-media'; } else { if ('download' === $type->name) { $icon = 'dashicons-download'; } else { if ('product' === $type->name) { $icon = 'dashicons-cart'; } } } } // Register the post type cap group. members_register_cap_group("type-{$type->name}", array('label' => $type->labels->name, 'caps' => $has_caps, 'icon' => $icon)); } // Register the taxonomy group. members_register_cap_group('taxonomy', array('label' => esc_html__('Taxonomies', 'members'), 'caps' => members_get_taxonomy_group_caps(), 'icon' => 'dashicons-tag', 'diff_added' => true)); // Register the theme group. members_register_cap_group('theme', array('label' => esc_html__('Appearance', 'members'), 'caps' => members_get_theme_group_caps(), 'icon' => 'dashicons-admin-appearance')); // Register the plugin group. members_register_cap_group('plugin', array('label' => esc_html__('Plugins', 'members'), 'caps' => members_get_plugin_group_caps(), 'icon' => 'dashicons-admin-plugins')); // Register the user group. members_register_cap_group('user', array('label' => esc_html__('Users', 'members'), 'caps' => members_get_user_group_caps(), 'icon' => 'dashicons-admin-users')); // Register the custom group. members_register_cap_group('custom', array('label' => esc_html__('Custom', 'members'), 'caps' => members_get_capabilities(), 'icon' => 'dashicons-admin-generic', 'diff_added' => true)); // Hook for registering cap groups. Plugins should always register on this hook. do_action('members_register_cap_groups'); }
function meteorslides_add_members_caps_group() { $meteor_cap_group_caps = array('meteorslides_edit_slide', 'meteorslides_edit_slides', 'meteorslides_edit_others_slides', 'meteorslides_publish_slides', 'meteorslides_read_slide', 'meteorslides_read_private_slides', 'meteorslides_delete_slide', 'meteorslides_delete_slides', 'meteorslides_manage_slideshows', 'meteorslides_manage_options'); $meteor_cap_group_args = array('label' => __('Meteor Slides', 'meteor-slides'), 'icon' => 'dashicons-images-alt2', 'caps' => $meteor_cap_group_caps, 'merge_added' => true, 'diff_added' => false); members_register_cap_group('type-meteor-slide', $meteor_cap_group_args); }