Modifications Copyright 2012-2015, Kevin Behrens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ $roles = $this->roles; $default = $this->current; if( defined('PP_ACTIVE') ) { require_once( dirname(__FILE__).'/pp-ui.php' ); $pp_ui = new Capsman_PP_UI(); $pp_metagroup_caps = $pp_ui->get_metagroup_caps( $default ); } else $pp_metagroup_caps = array(); ?>

>

remain in the database even if you deactivate this plugin.', 'capsman-enhanced' ); ?>
show_capability_hints( $default ); } else { global $capsman; $img_url = $capsman->mod_url . '/images/'; echo '
'; _e( "To further customize editing or viewing access, consider stepping up to Press Permit.", 'capsman-enhanced' ); echo '
'; ?>
  • (Pro)", 'capsman-enhanced' );?>
  • (Pro)", 'capsman-enhanced' );?>
  • (Pro)", 'capsman-enhanced' );?>
  • (Pro)", 'capsman-enhanced' );?>
  • (Pro)", 'capsman-enhanced' );?>
  • (Pro)", 'capsman-enhanced' );?>
  • (Pro)", 'capsman-enhanced' );?>
  • (Pro)", 'capsman-enhanced' );?>
  • (Pro)", 'capsman-enhanced' );?>
'; printf( __('%1$sgrab%2$s %3$s', 'capsman-enhanced'), '', '', 'Press Permit Core' ); echo '  •  '; printf( __('%1$sbuy%2$s %3$s', 'capsman-enhanced'), '', '', 'Press Permit Pro' ); echo '  •  '; echo 'hide'; echo '
'; } if ( MULTISITE ) { global $wp_roles; global $wpdb; if ( ! empty($_REQUEST['cme_net_sync_role'] ) ) { switch_to_blog(1); wp_cache_delete( $wpdb->prefix . 'user_roles', 'options' ); } ( method_exists( $wp_roles, 'for_site' ) ) ? $wp_roles->for_site() : $wp_roles->reinit(); } global $capsman; $capsman->reinstate_db_roles(); $current = get_role($default); //print_r($current); $rcaps = $current->capabilities; // ========= Begin Kevin B mod =========== $is_administrator = current_user_can( 'administrator' ); $custom_types = get_post_types( array( '_builtin' => false ), 'names' ); $custom_tax = get_taxonomies( array( '_builtin' => false ), 'names' ); $defined = array(); $defined['type'] = get_post_types( array( 'public' => true ), 'object' ); $defined['taxonomy'] = get_taxonomies( array( 'public' => true ), 'object' ); $unfiltered['type'] = apply_filters( 'pp_unfiltered_post_types', array('forum','topic','reply') ); // bbPress' dynamic role def requires additional code to enforce stored caps $unfiltered['taxonomy'] = apply_filters( 'pp_unfiltered_taxonomies', array( 'post_status', 'topic-tag' ) ); // avoid confusion with Edit Flow administrative taxonomy /* if ( ( count($custom_types) || count($custom_tax) ) && ( $is_administrator || current_user_can( 'manage_pp_settings' ) ) ) { $cap_properties[''] = array(); $force_distinct_ui = true; } */ $cap_properties['edit']['type'] = array( 'edit_posts' ); foreach( $defined['type'] as $type_obj ) { if ( 'attachment' != $type_obj->name ) { if ( isset( $type_obj->cap->create_posts ) && ( $type_obj->cap->create_posts != $type_obj->cap->edit_posts ) ) { $cap_properties['edit']['type'][]= 'create_posts'; break; } } } $cap_properties['edit']['type'][]= 'edit_others_posts'; $cap_properties['edit']['type'] = array_merge( $cap_properties['edit']['type'], array( 'publish_posts', 'edit_published_posts', 'edit_private_posts' ) ); $cap_properties['edit']['taxonomy'] = array( 'manage_terms' ); if ( ! defined( 'PP_ACTIVE' ) ) $cap_properties['edit']['taxonomy'] = array_merge( $cap_properties['edit']['taxonomy'], array( 'edit_terms', 'assign_terms' ) ); $cap_properties['delete']['type'] = array( 'delete_posts', 'delete_others_posts' ); $cap_properties['delete']['type'] = array_merge( $cap_properties['delete']['type'], array( 'delete_published_posts', 'delete_private_posts' ) ); if ( ! defined( 'PP_ACTIVE' ) ) $cap_properties['delete']['taxonomy'] = array( 'delete_terms' ); else $cap_properties['delete']['taxonomy'] = array(); $cap_properties['read']['type'] = array( 'read_private_posts' ); $cap_properties['read']['taxonomy'] = array(); $stati = get_post_stati( array( 'internal' => false ) ); //if ( count($stati) > 5 ) { $cap_type_names = array( '' => __( ' ', 'capsman-enhanced' ), 'read' => __( 'Reading', 'capsman-enhanced' ), 'edit' => __( 'Editing Capabilities', 'capsman-enhanced' ), 'delete' => __( 'Deletion Capabilities', 'capsman-enhanced' ) ); //} else { //} $cap_tips = array( 'read_private' => __( 'can read posts which are currently published with private visibility', 'capsman-enhanced' ), 'edit' => __( 'has basic editing capability (but may need other capabilities based on post status and ownership)', 'capsman-enhanced' ), 'edit_others' => __( 'can edit posts which were created by other users', 'capsman-enhanced' ), 'edit_published' => __( 'can edit posts which are currently published', 'capsman-enhanced' ), 'edit_private' => __( 'can edit posts which are currently published with private visibility', 'capsman-enhanced' ), 'publish' => __( 'can make a post publicly visible', 'capsman-enhanced' ), 'delete' => __( 'has basic deletion capability (but may need other capabilities based on post status and ownership)', 'capsman-enhanced' ), 'delete_others' => __( 'can delete posts which were created by other users', 'capsman-enhanced' ), 'delete_published' => __( 'can delete posts which are currently published', 'capsman-enhanced' ), 'delete_private' => __( 'can delete posts which are currently published with private visibility', 'capsman-enhanced' ), ); $default_caps = array( 'read_private_posts', 'edit_posts', 'edit_others_posts', 'edit_published_posts', 'edit_private_posts', 'publish_posts', 'delete_posts', 'delete_others_posts', 'delete_published_posts', 'delete_private_posts', 'read_private_pages', 'edit_pages', 'edit_others_pages', 'edit_published_pages', 'edit_private_pages', 'publish_pages', 'delete_pages', 'delete_others_pages', 'delete_published_pages', 'delete_private_pages', 'manage_categories' ); $type_caps = array(); // Role Scoper and PP1 adjust attachment access based only on user's capabilities for the parent post if ( defined('SCOPER_VERSION') || ( defined( 'PP_ACTIVE' ) && ! defined( 'PPC_VERSION' ) ) ) unset( $defined['type']['attachment'] ); echo '
    '; // cap_types: read, edit, deletion foreach( array_keys($cap_properties) as $cap_type ) { echo '
  • '; echo '

    ' . $cap_type_names[$cap_type] . '

    '; echo ''; foreach( array_keys($defined) as $item_type ) { if ( ( 'delete' == $cap_type ) && ( 'taxonomy' == $item_type ) ) { if ( defined('SCOPER_VERSION') || defined('PP_ACTIVE') ) continue; $any_term_deletion_caps = false; foreach( array_keys($defined['taxonomy']) as $_tax ) { if ( isset( $defined['taxonomy'][$_tax]->cap->delete_terms ) && ( 'manage_categories' != $defined['taxonomy'][$_tax]->cap->delete_terms ) && ! in_array( $_tax, $unfiltered['taxonomy'] ) ) { $any_term_deletion_caps = true; break; } } if ( ! $any_term_deletion_caps ) continue; } //if ( ! $cap_type ) { //} else { echo ''; if ( ! count( $cap_properties[$cap_type][$item_type] ) ) continue; // label cap properties foreach( $cap_properties[$cap_type][$item_type] as $prop ) { $prop = str_replace( '_posts', '', $prop ); $prop = str_replace( '_pages', '', $prop ); $prop = str_replace( '_terms', '', $prop ); $tip = ( isset( $cap_tips[$prop] ) ) ? "title='{$cap_tips[$prop]}'" : ''; $prop = str_replace( '_', '
    ', $prop ); $th_class = ( 'taxonomy' == $item_type ) ? ' class="term-cap"' : ' class="post-cap"'; echo "'; } foreach( $defined[$item_type] as $key => $type_obj ) { if ( in_array( $key, $unfiltered[$item_type] ) ) continue; $row = ""; if ( $cap_type ) { if ( empty($force_distinct_ui) && empty( $cap_properties[$cap_type][$item_type] ) ) continue; $row .= "'; $display_row = ! empty($force_distinct_ui); foreach( $cap_properties[$cap_type][$item_type] as $prop ) { $td_classes = array(); $checkbox = ''; if ( ! empty($type_obj->cap->$prop) && ( in_array( $type_obj->name, array( 'post', 'page' ) ) || ! in_array( $type_obj->cap->$prop, $default_caps ) || ( ( 'manage_categories' == $type_obj->cap->$prop ) && ( 'manage_terms' == $prop ) && ( 'category' == $type_obj->name ) ) ) ) { // if edit_published or edit_private cap is same as edit_posts cap, don't display a checkbox for it if ( ( ! in_array( $prop, array( 'edit_published_posts', 'edit_private_posts', 'create_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->edit_posts ) ) && ( ! in_array( $prop, array( 'delete_published_posts', 'delete_private_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->delete_posts ) ) ) { $cap_name = $type_obj->cap->$prop; if ( 'taxonomy' == $item_type ) $td_classes []= "term-cap"; else $td_classes []= "post-cap"; if ( ! empty($pp_metagroup_caps[$cap_name]) ) $td_classes []='cm-has-via-pp'; if ( $is_administrator || current_user_can($cap_name) ) { if ( ! empty($pp_metagroup_caps[$cap_name]) ) { $title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name ); } else { $title_text = $cap_name; } $disabled = ''; $checked = checked(1, ! empty($rcaps[$cap_name]), false ); $checkbox = ''; $type_caps [$cap_name] = true; $display_row = true; } } else $td_classes []= "cap-unreg"; if ( isset($rcaps[$cap_name]) && empty($rcaps[$cap_name]) ) $td_classes []= "cap-neg"; } else $td_classes []= "cap-unreg"; $td_class = ( $td_classes ) ? 'class="' . implode(' ', $td_classes) . '"' : ''; $row .= ""; } } if ( $display_row ) { $row .= ''; echo $row; } } //} // endif this iteration is for type caps checkbox display } // end foreach item type echo '
    "; echo ucwords($prop); echo '
    " . $type_obj->labels->name . ''; $row .= ' x '; $row .= 'X$checkbox"; if ( false !== strpos( $td_class, 'cap-neg' ) ) $row .= ''; $row .= "
    '; echo '
  • '; } echo '
'; // clicking on post type name toggles corresponding checkbox selections ?>  

' . __( 'Other WordPress Core Capabilities', 'capsman-enhanced' ) . '

'; echo ''; $checks_per_row = get_option( 'cme_form-rows', 5 ); $i = 0; $first_row = true; foreach( array_keys($core_caps) as $cap_name ) { if ( ! $is_administrator && ! current_user_can($cap_name) ) continue; if ( $i == $checks_per_row ) { echo ''; $i = 0; } if ( ! isset( $rcaps[$cap_name] ) ) $class = 'cap-no'; else $class = ( $rcaps[$cap_name] ) ? 'cap-yes' : 'cap-neg'; if ( ! empty($pp_metagroup_caps[$cap_name]) ) { $class .= ' cap-metagroup'; $title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name ); } else { $title_text = $cap_name; } $disabled = ''; $checked = checked(1, ! empty($rcaps[$cap_name]), false ); ?> '; $i = 0; } elseif ( ! $first_row ) { // Now close a wellformed table for ( $i; $i < $checks_per_row; $i++ ){ echo ''; } echo ''; } ?>
X x 
 
  X X
 

' . __( 'Additional Capabilities', 'capsman-enhanced' ) . '

'; ?> capabilities ), $this->ID ); $all_capabilities = apply_filters( 'members_get_capabilities', $all_capabilities ); foreach( $all_capabilities as $cap_name ) { if ( ! isset($this->capabilities[$cap_name]) ) $this->capabilities[$cap_name] = str_replace( '_', ' ', $cap_name ); } uasort( $this->capabilities, 'strnatcasecmp' ); // sort by array values, but maintain keys ); foreach ( $this->capabilities as $cap_name => $cap ) : if ( isset( $type_caps[$cap_name] ) || isset($core_caps[$cap_name]) ) continue; if ( ! $is_administrator && ! current_user_can($cap_name) ) continue; // ============ End Kevin B mod =============== // Levels are not shown. if ( preg_match( '/^level_(10|[0-9])$/i', $cap_name ) ) { continue; } if ( $i == $checks_per_row ) { echo ''; $i = 0; $first_row = false; } if ( ! isset( $rcaps[$cap_name] ) ) $class = 'cap-no'; else $class = ( $rcaps[$cap_name] ) ? 'cap-yes' : 'cap-neg'; if ( ! empty($pp_metagroup_caps[$cap_name]) ) { $class .= ' cap-metagroup'; $title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name ); } else { $title_text = $cap_name; } $disabled = ''; $checked = checked(1, ! empty($rcaps[$cap_name]), false ); if ( 'manage_capabilities' == $cap_name ) { if ( ! current_user_can('administrator') ) { continue; } elseif ( 'administrator' == $default ) { $class .= ' cap-locked'; $lock_manage_caps_capability = true; $disabled = 'disabled="disabled"'; } } ?> '; } if ( $i == $checks_per_row ) { echo ''; $i = 0; } else { if ( ! $first_row ) { // Now close a wellformed table for ( $i; $i < $checks_per_row; $i++ ){ echo ''; } echo ''; } } ?>
X x 
 
  X X

"edit_users").', 'capsman-enhanced' ); ?>
pp_only_roles_ui( $default ) : false; cme_network_role_ui( $default ); ?>

  ID}&action=delete&role={$default}", 'delete-role_' . $default); ?>" onclick="if ( confirm('') ) { return true;}return false;">