//shortcodes dans bb press
function pw_bbp_shortcodes( $content, $reply_id ) {
$reply_author = bbp_get_reply_author_id( $reply_id );
if( user_can( $reply_author, pw_bbp_parse_capability() ) )
return do_shortcode( $content );
return $content;
}
add_filter(‘bbp_get_the_content’, ‘pw_bbp_shortcodes’, 10, 2);
add_filter(‘bbp_get_reply_content’, ‘pw_bbp_shortcodes’, 10, 2);
add_filter(‘bbp_get_topic_content’, ‘pw_bbp_shortcodes’, 10, 2);
function pw_bbp_parse_capability() {
return apply_filters( ‘pw_bbp_parse_shortcodes_cap’, ‘publish_forums’ );
}
// tinymce editor pour bbpress
function bbp_enable_visual_editor( $args = array() ) {
$args[‘tinymce’] = true;
return $args;
}
add_filter( ‘bbp_after_get_the_content_parse_args’, ‘bbp_enable_visual_editor’ );
// Switch off bbPress Forum moderation
add_filter( ‘bbp_bypass_check_for_moderation’, ‘__return_true’ );
//role user
function custom_capabilities( $role )
{
switch ( $role )
{
// Participant/Default
case bbp_get_participant_role() :
default :
$caps = array(
// Primary caps
'spectate' => true,
'participate' => true,
// Forum caps
'publish_forums' => false,
'edit_forums' => true,
'edit_others_forums' => true,
'delete_forums' => false,
'delete_others_forums' => false,
'read_private_forums' => true,
'read_hidden_forums' => true,
// Topic caps
'publish_topics' => true,
'edit_topics' => true,
'edit_others_topics' => true,
'delete_topics' => false,
'delete_others_topics' => false,
'read_private_topics' => true,
// Reply caps
'publish_replies' => true,
'edit_replies' => true,
'edit_others_replies' => true,
'delete_replies' => false,
'delete_others_replies' => false,
'read_private_replies' => true,
// Topic tag caps
'manage_topic_tags' => true,
'edit_topic_tags' => true,
'delete_topic_tags' => true,
'assign_topic_tags' => true
);
break;
}
}