bbp_format_revision_reason

Formats the reason for editing the topic/reply.

Description

(string) bbp_format_revision_reason( (string) $reason = '' ); 

Does these things: - Trimming - Removing periods from the end of the string - Trimming again

Returns (string)

Status of topic

Parameters (1)

0. $reason — Optional. (string) => ''
Topic id

Usage

  1. if ( !function_exists( 'bbp_format_revision_reason' ) ) { 
  2. require_once '/includes/common/functions.php'; 
  3.  
  4. // Optional. Topic id 
  5. $reason = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_format_revision_reason($reason); 
  9.  

Defined (1)

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

/includes/common/functions.php  
  1. function bbp_format_revision_reason( $reason = '' ) { 
  2. $reason = (string) $reason; 
  3.  
  4. // Format reason for proper display 
  5. if ( empty( $reason ) ) 
  6. return $reason; 
  7.  
  8. // Trimming 
  9. $reason = trim( $reason ); 
  10.  
  11. // We add our own full stop. 
  12. while ( substr( $reason, -1 ) === '.' ) 
  13. $reason = substr( $reason, 0, -1 ); 
  14.  
  15. // Trim again 
  16. $reason = trim( $reason ); 
  17.  
  18. return $reason;