static function manage_disclosure_column($column, $post_ID)
 {
     global $wp_roles;
     // 		var_dump($column,current_filter());
     switch ($column) {
         case 'view_cap':
             $names = array_merge(array('exist' => __('Everybody', 'wp-access-areas'), 'read' => __('Blog users', 'wp-access-areas')), UndisclosedUserlabel::get_label_array(), $wp_roles->get_names());
             $names[''] = $names['exist'];
             $val = get_post($post_ID)->post_view_cap;
             _e($names[$val]);
             break;
         case 'comment_cap':
             $names = array_merge(array('exist' => __('Everybody', 'wp-access-areas'), 'read' => __('Blog users', 'wp-access-areas')), UndisclosedUserlabel::get_label_array(), $wp_roles->get_names());
             $names[''] = $names['exist'];
             $val = get_post($post_ID)->post_comment_cap;
             _e($names[$val]);
             break;
         case 'edit_cap':
             $names = array_merge(array('exist' => __('Everybody', 'wp-access-areas'), 'read' => __('Blog users', 'wp-access-areas')), UndisclosedUserlabel::get_label_array(), $wp_roles->get_names());
             $names[''] = $names['exist'];
             $val = get_post($post_ID)->post_edit_cap;
             _e($names[$val]);
             break;
     }
 }
        static function select_default_caps()
        {
            $option_values = get_option('wpaa_default_caps');
            $post_types = get_post_types(array('show_ui' => true));
            global $wp_roles;
            $roles = $wp_roles->get_names();
            $user_role_caps = wpaa_get_user_role_caps();
            $rolenames = array();
            $edit_rolenames = array();
            foreach ($roles as $role => $rolename) {
                $rolenames[$role] = $rolename;
            }
            $groups = UndisclosedUserlabel::get_label_array();
            ?>
<table class="wp-list-table widefat set-default-caps"><?php 
            ?>
<thead><?php 
            ?>
<tr><?php 
            ?>
<th class="manage-column"><?php 
            _e('Post Type', 'wp-access-areas');
            ?>
</th><?php 
            ?>
<th class="manage-column"><?php 
            _e('Reading');
            ?>
</th><?php 
            ?>
<th class="manage-column"><?php 
            _e('Edit');
            ?>
</th><?php 
            ?>
<th class="manage-column"><?php 
            _e('Post Comment');
            ?>
</th><?php 
            ?>
</tr><?php 
            ?>
</thead><?php 
            ?>
<tfoot><?php 
            ?>
<tr><?php 
            ?>
<th class="manage-column"><?php 
            _e('Post Type', 'wp-access-areas');
            ?>
</th><?php 
            ?>
<th class="manage-column"><?php 
            _e('Reading');
            ?>
</th><?php 
            ?>
<th class="manage-column"><?php 
            _e('Edit');
            ?>
</th><?php 
            ?>
<th class="manage-column"><?php 
            _e('Post Comment');
            ?>
</th><?php 
            ?>
</tr><?php 
            ?>
</tfoot><?php 
            ?>
<tbody><?php 
            $alternate = false;
            foreach ($post_types as $post_type) {
                $post_type_object = get_post_type_object($post_type);
                $editing_cap = $post_type_object->cap->edit_posts;
                $alternate = !$alternate;
                $edit_rolenames = array();
                foreach ($roles as $role => $rolename) {
                    if (get_role($role)->has_cap($editing_cap)) {
                        $edit_rolenames[$role] = $rolename;
                    }
                }
                ?>
<tr class="post-select <?php 
                if ($alternate) {
                    echo "alternate";
                }
                ?>
"><?php 
                ?>
<th><?php 
                echo $post_type_object->labels->name;
                ?>
</th><?php 
                ?>
<td><?php 
                $action = 'post_view_cap';
                $cap = isset($option_values[$post_type][$action]) ? $option_values[$post_type][$action] : 'exist';
                if ($post_type != 'attachment' && ($post_type_object->public || $post_type_object->show_ui)) {
                    UndisclosedEditPost::access_area_dropdown($roles, $groups, wpaa_sanitize_access_cap($cap), "wpaa_default_caps[{$post_type}][{$action}]");
                }
                ?>
</td><?php 
                ?>
<td><?php 
                $action = 'post_edit_cap';
                $cap = isset($option_values[$post_type][$action]) ? $option_values[$post_type][$action] : 'exist';
                UndisclosedEditPost::access_area_dropdown($edit_rolenames, $groups, wpaa_sanitize_access_cap($cap), "wpaa_default_caps[{$post_type}][{$action}]");
                ?>
</td><?php 
                ?>
<td><?php 
                $action = 'post_comment_cap';
                $cap = isset($option_values[$post_type][$action]) ? $option_values[$post_type][$action] : 'exist';
                if (post_type_supports($post_type, 'comments')) {
                    UndisclosedEditPost::access_area_dropdown($roles, $groups, wpaa_sanitize_access_cap($cap), "wpaa_default_caps[{$post_type}][{$action}]");
                }
                ?>
</td><?php 
                ?>
</tr><?php 
            }
            ?>
</tbody><?php 
            ?>
</table><?php 
        }
 private static function _get_where($where, $table_name = 'p')
 {
     global $wpdb;
     // disable filtering: on queries for single posts/pages and for single blog administrators
     if (is_singular() && preg_match("/{$wpdb->posts}.(post_name|ID)\\s?=/", $where) || !is_multisite() && current_user_can('administrator')) {
         return $where;
     }
     if ($table_name && substr($table_name, -1) !== '.') {
         $table_name .= '.';
     }
     $caps = array('exist');
     if (is_user_logged_in()) {
         // get current user's groups
         $roles = new WP_Roles();
         // reading
         if (current_user_can('read')) {
             $caps[] = 'read';
         }
         // user's roles
         $user_roles = wpaa_user_contained_roles();
         foreach ($user_roles as $role) {
             $caps[] = $role;
         }
         // user's custom caps
         foreach (UndisclosedUserlabel::get_label_array() as $cap => $capname) {
             if (wpaa_user_can_accessarea($cap)) {
                 $caps[] = $cap;
             }
         }
     }
     $add_where = " {$table_name}post_view_cap IN ('" . implode("','", $caps) . "')";
     //		if ( is_single() ) // why did I do this....?
     //			$add_where .= " OR (wpaa_postmeta.meta_value IS NOT NULL)";
     $add_where = " AND ( {$add_where} ) ";
     return $where . $add_where;
 }