In my system, I'm making two new roles:
- Third Party (
TP
) (lesser privileges) - Data Entry Operator (
DEO
) (powerful over Third Party - but not of its own group)
My CPT 'capabilities' parameter is revamped using 'map_meta_cap' => true
like:
...
'capabilities' => array ( 'read' => 'read_cpt', 'edit_posts' => 'edit_cpt' ),
'map_meta_cap' => true
...
Scenario is: TP
can add their contents freely, but can't publish. DEO
s can add their contents freely too, and additionally DEO
s can edit/modify TP
's contents, and finally can publish 'em. But they (DEO
s) can't touch each other's posts of their own role. Suppose, 'X as a DEO
' added an article, 'Y as a DEO
' can't touch on it. But X and Y can individually touch posts of 'Z as a TP
'.
While adding new role, I'm doing:
$tp = add_role(
'third_party',
__('Third Party'),
array(
'read_cpt' => true,
'edit_cpt' => true,
//'edit_others_cpt => false //by default not assigned
)
);
$deo = add_role(
'data_entry_operator',
__('Data Entry Operator'),
array(
'read_cpt' => true,
'edit_cpt' => true,
'edit_others_cpt => true
)
);
You know, edit_others_cpt
will access them editing TP
's posts, but won't restrict them of editing posts of their own user role (DEO
).
How can I let DEO
'edit_others_posts' of TP
role only, not of DEO
?