Forum Replies Created

Viewing 1 replies (of 1 total)
  • i edited the file:
    CTXPS_Security.phh

    look for the line containing the function definition start:
    public static function get_term_protection($term_id,$taxonomy){

    replace this function by:

    public static function get_term_protection($term_id,$taxonomy){
            //If this branch isn't protected, just stop now and save all that processing power
            if (!CTXPS_Queries::check_term_protection($term_id,$taxonomy)){
                return false;
            }
    
            //If we're still going, then it means something above us is protected, so lets get the list of permissions
            global $wpdb;
            $return = array();
            $group_array = array();
            /**Gets the parent id of the current page/post*/
            $parent_id = get_term($term_id,$taxonomy);
            $parent_id = (integer)$parent_id->parent;
            /**Gets the ctx_ps_security data for this post (if it exists) - used to determine if this is the topmost secured page*/
            //$amisecure = get_post_meta($postid,'ctx_ps_security',true);
    
            //1. If I am secure, get my groups
            //if(!empty($amisecure)){
                //Get Group relationship info for this page from wp_ps_security, join wp_posts on postid
                $groups = CTXPS_Queries::get_groups_by_object('term',$term_id, true);
    
                //If 0 results, dont do anything. Otherwise...
                if(!empty($groups)){
                    foreach($groups as $group){
                        $group_array[$group->group_id] = $group->group_title;
                    }unset($group);
                }
            //}
            //Add an item to the array. 'pageid'=>array('groupid','groupname')
            $return[(string)$term_id] = $group_array;
            unset($group_array);
            //2. If I have a parent, recurse
                //Using our earlier results, check post_parent. If it's != 0 then recurse this function, adding the return value to $array
                if($parent_id != 0){
                    //$recursedArray = CTXPS_Security::get_protection($parentid);
                    //$array = array_merge($array,$recursedArray);
                    $parent_array = self::get_term_protection($parent_id,$taxonomy);
                    if(!!$parent_array){
                      $return += $parent_array;
                    }
                }
    
            //3. Return the completed $array
            return $return;
        }

    and change line 362 into:
    return self::get_term_protection($content_id,$taxonomy);

    this removed the errors for me.

    the functionality of not showing the menu items of protected categories and posts still works so this looks like a good addition to the original files.

Viewing 1 replies (of 1 total)