Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cbox_fix_bbp_new_topic_button() {
- // if groups isn't active, stop now!
- if ( ! bp_is_active( 'groups' ) )
- return;
- // if the bbPress plugin isn't enabled, stop now!
- if ( ! function_exists( 'bbpress' ) )
- return;
- // remove the 'New Topic' button
- // this is done because the 'bp_get_group_new_topic_button' filter doesn't
- // work propelry
- remove_action( 'bp_group_header_actions', 'bp_group_new_topic_button' );
- // If these conditions are met, this button should not be displayed
- if ( !is_user_logged_in() || !bp_is_group_forum() || bp_is_group_forum_topic()|| bp_group_is_user_banned() )
- return false;
- // add our customized 'New Topic' button
- add_action( 'bp_group_header_actions', create_function( '', "
- bp_button( array(
- 'id' => 'new_topic',
- 'component' => 'groups',
- 'must_be_logged_in' => true,
- 'block_self' => true,
- 'wrapper_class' => 'group-button',
- 'link_href' => '#new-post', // anchor modified
- 'link_class' => 'group-button', // removed a link_class here
- 'link_id' => 'new-topic-button',
- 'link_text' => __( 'New Topic', 'buddypress' ),
- 'link_title' => __( 'New Topic', 'buddypress' ),
- ) );
- " ) );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement