Advertisement
Guest User

Untitled

a guest
Dec 13th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. function cbox_fix_bbp_new_topic_button() {
  2. // if groups isn't active, stop now!
  3. if ( ! bp_is_active( 'groups' ) )
  4. return;
  5.  
  6. // if the bbPress plugin isn't enabled, stop now!
  7. if ( ! function_exists( 'bbpress' ) )
  8. return;
  9.  
  10. // remove the 'New Topic' button
  11. // this is done because the 'bp_get_group_new_topic_button' filter doesn't
  12. // work propelry
  13. remove_action( 'bp_group_header_actions', 'bp_group_new_topic_button' );
  14.  
  15. // If these conditions are met, this button should not be displayed
  16. if ( !is_user_logged_in() || !bp_is_group_forum() || bp_is_group_forum_topic()|| bp_group_is_user_banned() )
  17. return false;
  18.  
  19. // add our customized 'New Topic' button
  20. add_action( 'bp_group_header_actions', create_function( '', "
  21. bp_button( array(
  22. 'id' => 'new_topic',
  23. 'component' => 'groups',
  24. 'must_be_logged_in' => true,
  25. 'block_self' => true,
  26. 'wrapper_class' => 'group-button',
  27. 'link_href' => '#new-post', // anchor modified
  28. 'link_class' => 'group-button', // removed a link_class here
  29. 'link_id' => 'new-topic-button',
  30. 'link_text' => __( 'New Topic', 'buddypress' ),
  31. 'link_title' => __( 'New Topic', 'buddypress' ),
  32. ) );
  33. " ) );
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement