bbp_topic_notices

Displays topic notices.

Description

bbp_topic_notices(); 

Usage

  1. if ( !function_exists( 'bbp_topic_notices' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bbp_topic_notices(); 
  7.  

Defined (1)

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

/includes/topics/template.php  
  1. function bbp_topic_notices() { 
  2.  
  3. // Bail if not viewing a topic 
  4. if ( !bbp_is_single_topic() ) 
  5. return; 
  6.  
  7. // Get the topic_status 
  8. $topic_status = bbp_get_topic_status(); 
  9.  
  10. // Get the topic status 
  11. switch ( $topic_status ) { 
  12.  
  13. // Spam notice 
  14. $notice_text = __( 'This topic is marked as spam.', bbpress ); 
  15. break; 
  16.  
  17. // Trashed notice 
  18. $notice_text = __( 'This topic is in the trash.', bbpress ); 
  19. break; 
  20.  
  21. // Standard status 
  22. default : 
  23. $notice_text = ''; 
  24. break; 
  25.  
  26. // Filter notice text and bail if empty 
  27. $notice_text = apply_filters( 'bbp_topic_notices', $notice_text, $topic_status, bbp_get_topic_id() ); 
  28. if ( empty( $notice_text ) ) 
  29. return; 
  30.  
  31. bbp_add_error( 'topic_notice', $notice_text, 'message' );