Problem with custom role
-
Wordpress : WordPress 4.7.4 avec le thème BlackFyre.
bbpress : Version 2.5.12
http://www.vieuxetmechants.com/Hello i’ve created custom and i don’t understand the role MembreVetM can’t edit or delete their own post
function add_new_roles( $bbp_roles ) { $bbp_roles['bbp_gamer'] = array( 'name' => 'Gamer', 'capabilities' => custom_capabilities( 'bbp_gamer' ) ); $bbp_roles['bbp_membrevetm'] = array( 'name' => 'MembreVetM', 'capabilities' => custom_capabilities( 'bbp_membrevetm' ) ); $bbp_roles['bbp_veteran'] = array( 'name' => 'Vétéran', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) ); $bbp_roles['bbp_officier'] = array( 'name' => 'Officier', 'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) ); return $bbp_roles; } add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 ); function add_role_caps_filter( $caps, $role ) { /* Only filter for roles we are interested in! */ if( $role == 'bbp_gamer' ) $caps = custom_capabilities( $role ); if( $role == 'bbp_membrevetm' ) $caps = custom_capabilities( $role ); return $caps; } add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 ); function custom_capabilities( $role ) { switch ( $role ) { case 'bbp_gamer': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => false, 'throttle' => false, 'view_trash' => false, // Forum caps 'publish_forums' => false, 'edit_forums' => false, 'edit_others_forums' => false, 'delete_forums' => false, 'delete_others_forums' => false, 'read_private_forums' => false, 'read_hidden_forums' => false, // Topic caps 'publish_topics' => true, 'edit_topics' => true, 'edit_others_topics' => false, 'delete_topics' => false, 'delete_others_topics' => false, 'read_private_topics' => false, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => false, 'delete_replies' => false, 'delete_others_replies' => false, 'read_private_replies' => false, // Topic tag caps 'manage_topic_tags' => false, 'edit_topic_tags' => false, 'delete_topic_tags' => false, 'assign_topic_tags' => false, ); case 'bbp_membrevetm': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => false, 'throttle' => false, 'view_trash' => false, // Forum caps 'publish_forums' => false, 'edit_forums' => false, 'edit_others_forums' => false, 'delete_forums' => false, 'delete_others_forums' => false, 'read_private_forums' => true, 'read_hidden_forums' => false, // Topic caps 'publish_topics' => true, 'edit_topics' => true, 'edit_others_topics' => false, 'delete_topics' => true, 'delete_others_topics' => false, 'read_private_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => false, 'delete_replies' => true, 'delete_others_replies' => false, 'read_private_replies' => true, // Topic tag caps 'manage_topic_tags' => true, 'edit_topic_tags' => false, 'delete_topic_tags' => true, 'assign_topic_tags' => true, ); break; default : return $role; } }
- You must be logged in to reply to this topic.