bp_get_group_new_topic_button

Returns a 'New Topic' button for a group.

Description

(string) bp_get_group_new_topic_button( (bool) $group = false ); 

Returns (string)

HTML code for the button.

Parameters (1)

0. $group — Optional. (bool) => false
The BP Groups_Group object if passed, boolean false if not passed.

Usage

  1. if ( !function_exists( 'bp_get_group_new_topic_button' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-groups/bp-groups-template.php'; 
  3.  
  4. // The BP Groups_Group object if 
  5. // passed, boolean false if not passed. 
  6. $group = false; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = bp_get_group_new_topic_button($group); 
  10.  

Defined (1)

The function is defined in the following location(s).

/bp-groups/bp-groups-template.php  
  1. function bp_get_group_new_topic_button( $group = false ) { 
  2. global $groups_template; 
  3.  
  4. if ( empty( $group ) ) { 
  5. $group =& $groups_template->group; 
  6.  
  7. if ( !is_user_logged_in() || bp_group_is_user_banned() || !bp_is_group_forum() || bp_is_group_forum_topic() ) { 
  8. return false; 
  9.  
  10. $button = array( 
  11. 'id' => 'new_topic',  
  12. 'component' => 'groups',  
  13. 'must_be_logged_in' => true,  
  14. 'block_self' => true,  
  15. 'wrapper_class' => 'group-button',  
  16. 'link_href' => '#post-new',  
  17. 'link_class' => 'group-button show-hide-new',  
  18. 'link_id' => 'new-topic-button',  
  19. 'link_text' => __( 'New Topic', buddypress ),  
  20. ); 
  21.  
  22. /** 
  23. * Filters the HTML button for creating a new topic in a group. 
  24. * @since 1.5.0 
  25. * @since 2.5.0 Added the `$group` parameter. 
  26. * @param string $button HTML button for a new topic. 
  27. * @param object $group Group object. 
  28. */