permission.php
// Change page dropdown to only include users pages
Change page dropdown to only include users pages
Change page dropdown to only include users pages
public function page_dropdown($args, $post)
    {
        $user_page = get_user_meta($this->user_id, 'permission', true);
        $pages     = $this->user_can_edit_pages( $this->user_id );
        $args =  [
            'selected'         => $post->post_parent,
            'name'             => 'parent_id',
            'include'          => $pages,
            'sort_column'      => 'ID',
            'echo'             => false,
        ];
        if( $post->ID == $user_page ) {
            $parent = wp_get_post_parent_id($user_page);
            $args['selected'] =  $parent;
            $args['include'] =  array_merge( [$parent], $pages );
        }
        return $args;
    }
public function page_dropdown ( $ args , $ post ) { $ user_page = get_user_meta ( $ this -> user_id , 'permission' , true ) ; $ pages = $ this -> user_can_edit_pages ( $ this -> user_id ) ; $ args = [ 'selected' => $ post -> post_parent , 'name' => 'parent_id' , 'include' => $ pages , 'sort_column' => 'ID' , 'echo' => false , ] ; if ( $ post -> ID == $ user_page ) { $ parent = wp_get_post_parent_id ( $ user_page ) ; $ args [ 'selected' ] = $ parent ; $ args [ 'include' ] = array_merge ( [ $ parent ] , $ pages ) ; } return $ args ; }
Change page dropdown to only include users pages
Change page dropdown to only include users pages
// If the post id is the users top page // Set that parent to selected