Title: Incorrect capabilities in plugin
Last modified: April 20, 2019

---

# Incorrect capabilities in plugin

 *  [tazotodua](https://wordpress.org/support/users/tazotodua/)
 * (@tazotodua)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/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)

 *  [Puvox Software](https://wordpress.org/support/users/puvoxsoftware/)
 * (@puvoxsoftware)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/incorrect-capabilities-in-plugin/#post-11454150)
 * 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](https://wordpress.org/support/users/nko/)
 * (@nko)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/incorrect-capabilities-in-plugin/#post-11464299)
 * Hey [@tazotodua](https://wordpress.org/support/users/tazotodua/) [@puvoxsoftware](https://wordpress.org/support/users/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.

 * ![](https://ps.w.org/visual-portfolio/assets/icon-256x256.png?rev=2389881)
 * [Visual Portfolio, Photo Gallery & Post Grid](https://wordpress.org/plugins/visual-portfolio/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/visual-portfolio/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/visual-portfolio/)
 * [Active Topics](https://wordpress.org/support/plugin/visual-portfolio/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/visual-portfolio/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/visual-portfolio/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [nK](https://wordpress.org/support/users/nko/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/incorrect-capabilities-in-plugin/#post-11464299)
 * Status: not resolved