Support » Plugin: Visual Portfolio, Photo Gallery & Posts Grid » Incorrect capabilities in plugin

  • There is quite incorrect capabilities coded in the plugin.
    the portfolio and vp_lists post types have the same capabilities, that makes bunch of problems with our sites.

    for example, we want to grant specific capability to specific role (i.e. using codes or plugins like Role Editor) and we assing “edit portfolio” capability to “contributor” role.

    then s/he automatically gets capability (because it’s same) to edit vp_lists (layouts) too.

    so, they should have different capabilities. at this moment, it’s coded like this in your plugin “classes/class-admin.php”:

                    'capabilities' => array(
                        'edit_post' => 'edit_portfolio',
                        'edit_posts' => 'edit_portfolios',
                        'edit_others_posts' => 'edit_other_portfolios',
                        'publish_posts' => 'publish_portfolios',
                        'read_post' => 'read_portfolio',
                        'read_private_posts' => 'read_private_portfolios',
                        'delete_posts' => 'delete_portfolios',
                        'delete_post' => 'delete_portfolio',
                    ),

    in both places this code is used for portfolio and for vp_lists.
    please ammend, as they should have different capability names, like:

    ` ‘capabilities’ => array(
    ‘edit_post’ => ‘edit_portfolio_layout’ //instead of ‘edit_portfolio’
    ….

Viewing 2 replies - 1 through 2 (of 2 total)
  • at this moment, i used this code as workaround. but please add option (with checkbox) to be used this config automatically:

    
    add_filter( 'register_post_type_args', 'modify_p_args', 10, 2 );
    function modify_p_args( $args, $name ) 
    {
    	if ( 'portfolio' === $name ) 
    	{
    		$args['capability_type']= "post"; 
    		$args['capabilities']= array(
    			'read_post'			=> 'read_portfolio',
    			'edit_post'			=> 'edit_portfolio',
    			'delete_post'		=> 'delete_portfolio',
    			//
    			'edit_posts'		=> 'edit_portfolios',
    			'edit_others_posts'	=> 'edit_others_portfolios',
    			'delete_others_posts'=>'delete_others_portfolios',
    			'publish_posts'		=> 'publish_portfolios',
    			'read_private_posts'=> 'read_private_portfolios',
    			'delete_posts'		=> 'delete_portfolios',
    			'create_posts'		=> 'edit_portfolios'
    		);
    		$args['map_meta_cap']= true;
    		// unset($args['capabilities']);  $args['map_meta_cap']= false;
    	}
    	
    	if ( 'vp_lists' === $name ) 
    	{
    		$args['capabilities']= array(
    			'edit_post' => 'edit_portfolio_layout',
    			'edit_posts' => 'edit_portfolios_layout',
    			'edit_others_posts' => 'edit_other_portfolios_layout',
    			'publish_posts' => 'publish_portfolios_layout',
    			'read_post' => 'read_portfolio_layout',
    			'read_private_posts' => 'read_private_portfolios_layout',
    			'delete_posts' => 'delete_portfolios_layout',
    			'delete_post' => 'delete_portfolio_layout'
    		); 
    	}
    	
    	return $args;
    }
    Plugin Author nK

    (@nko)

    Hey @tazotodua @puvoxsoftware.

    In the coming plugin update capabilities will be fixed, also added new roles: Portfolio Manager and Portfolio Author.

    Regards, nK.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Incorrect capabilities in plugin’ is closed to new replies.