Tagged: 

Viewing 5 reply threads
  • Author
    Posts
    • #1830
      kattagami
      Member

      Hello,

      I try to hide a metabox for my “Suscriber” users with the Piklist Capability in the comment and the WP compabilities.

      /*
      Title: Evaluations du projet
      Post Type: projets
      Capability: edit_others_posts
      */

      To do this, I use the capability “edit_others_posts” because Suscriber don’t have this capability. Unfortunetly, my suscriber still see the metabox.

      Is it a bug?

    • #1834
      Steve
      Keymaster

      @kattagami– I can’t reproduce this error. Seems to work for me. Can you post the code used to register “projets”?

    • #1837
      kattagami
      Member

      Yep, this is my code:

      add_filter( 'piklist_post_types' , 'projets_post_type' );
      function projets_post_type( $post_types ) {
      	$post_types[ 'projets' ] = array(
      				'labels' => piklist( 'post_type_labels' , 'Projet'),
      				'title' => __( 'Entrer un nouveau titre de projet' ),
      				'public' => true,
      				'menu_position' => 5,
      				'rewrite' 	=> array(
        							slug' => 'projets',
      							),
      				'supports' 	=> array(
        							'title',
        							'editor',
      							),
      				'hide_meta_box' => array(
        							'slug',
      					  		'author',
      					  		'revisions',
      					  		'comments',
      					  		'commentstatus',
      							),
      								);
      return $post_types;
      }
    • #1838
      Steve
      Keymaster

      @kattagami–- I still can’t reproduce. The meta box works perfect for me.

      You may want to run your own tests to see if you can find the bug. Open class-piklist-cpt.php. The line that looks like: && (!$data['capability'] || ($data['capability'] && current_user_can(strtolower($data['capability'])))) contains the logic. Try some of your own if statements with current_user_can to see if you can figure out why it’s not working.

    • #1843
      kattagami
      Member

      If I look what wp_get_current_user() return, I can see that my “Suscribers” have a lot of capabilities set to “True” like “edit_others_posts”

      I don’t know why, probably an effect of another plugin. I’m still looking for …

      Thanks Steve for your advices.

    • #1844
      Steve
      Keymaster

      @kattagami– Glad it wasn’t a Piklist bug and you were able to identify the issue.

Viewing 5 reply threads
  • The topic ‘Hide meta box with Capability, bug?’ is closed to new replies.