Tagged: capability
- This topic has 5 replies, 2 voices, and was last updated 7 years, 7 months ago by
Steve.
-
AuthorPosts
-
-
June 17, 2014 at 9:18 am #1830
kattagamiMemberHello,
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?
-
June 17, 2014 at 9:44 am #1834
SteveKeymaster@kattagami– I can’t reproduce this error. Seems to work for me. Can you post the code used to register “projets”?
-
June 17, 2014 at 11:22 am #1837
kattagamiMemberYep, 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; } -
June 18, 2014 at 11:01 am #1838
SteveKeymaster@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 ownifstatements withcurrent_user_canto see if you can figure out why it’s not working. -
June 19, 2014 at 6:08 am #1843
kattagamiMemberIf 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.
-
June 19, 2014 at 9:25 am #1844
SteveKeymaster@kattagami– Glad it wasn’t a Piklist bug and you were able to identify the issue.
-
-
AuthorPosts
- The topic ‘Hide meta box with Capability, bug?’ is closed to new replies.