Empêche les contributeurs de publier les posts dont ils sont membres

This commit is contained in:
2026-05-28 18:02:23 +02:00
parent ccf32dcece
commit c1cad3b044

View File

@@ -581,17 +581,19 @@ function thalim_membres_can_edit_post( $allcaps, $caps, $args, $user ) {
// Meta caps that carry a post ID in $args[2] (e.g. wp-admin/post.php load).
$meta_caps_with_id = [ 'edit_post', 'edit_page' ];
// Primitive caps called during the admin save/publish flow *without* a
// Primitive caps called during the admin save flow *without* a
// post_id (e.g. wp-admin/includes/post.php:76 checks edit_others_posts
// directly when $post_author !== current user). We infer the post_id from
// the request so we can still authorize membres per-post.
//
// NOTE: publish_posts / publish_pages are intentionally NOT in this list —
// contributors listed in `membres` must be able to edit (incl. published)
// posts of the lab, but only editors/admins should be able to publish.
$primitive_caps_in_save_flow = [
'edit_others_posts',
'edit_others_pages',
'edit_published_posts',
'edit_published_pages',
'publish_posts',
'publish_pages',
];
$post_id = 0;