bbp_reply_content_append_user_signature

The bbP Signature bbp reply content append user signature function.

Description

bbp_reply_content_append_user_signature( (string) $content = '', (int) $reply_id = 0, (array) $args = array() ); 

Parameters (3)

0. $content — Optional. (string) => ''
The content.
1. $reply_id — Optional. (int)
The reply id.
2. $args — Optional. (array) => array()
The args.

Usage

  1. if ( !function_exists( 'bbp_reply_content_append_user_signature' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbp-signature/bbp-signature.php'; 
  3.  
  4. // The content. 
  5. $content = ''; 
  6.  
  7. // The reply id. 
  8. $reply_id = -1; 
  9.  
  10. // The args. 
  11. $args = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bbp_reply_content_append_user_signature($content, $reply_id, $args); 
  15.  

Defined (1)

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

/bbp-signature.php  
  1. function bbp_reply_content_append_user_signature( $content = '', $reply_id = 0, $args = array() ) { 
  2. // Default arguments 
  3. $defaults = array( 
  4. 'separator' => '<hr />',  
  5. 'before' => '<div class="bbp-reply-signature">',  
  6. 'after' => '</div>' 
  7. ); 
  8. $r = wp_parse_args( $args, $defaults ); 
  9. extract( $r ); 
  10.  
  11. // Verify topic id, get author id, and potential signature 
  12. $reply_id = bbp_get_reply_id ( $reply_id ); 
  13. $user_id = bbp_get_reply_author_id( $reply_id ); 
  14. if(function_exists('bp_has_groups')) { 
  15. $signature = xprofile_get_field_data( 'Signature', $user_id ); 
  16. else { 
  17. $signature = bbp_get_user_signature ( $user_id ); 
  18.  
  19. // If signature exists, adjust the content accordingly 
  20. if ( !empty( $signature ) ) 
  21. $content = $content . $separator . $before . $signature . $after; 
  22.  
  23. return apply_filters( 'bbp_reply_content_append_signature', $content, $reply_id, $separator );