bbp_update_reply_revision_log

Update the revision log of the reply.

Description

bbp_update_reply_revision_log( (string) $args = '' ); 

Parameters (1)

0. $args — Optional. (string) => ''
Supports these args: - reply_id: reply id - author_id: Author id - reason: Reason for editing - revision_id: Revision id

Usage

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

Defined (1)

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

/includes/replies/functions.php  
  1. function bbp_update_reply_revision_log( $args = '' ) { 
  2.  
  3. // Parse arguments against default values 
  4. $r = bbp_parse_args( $args, array( 
  5. 'reason' => '',  
  6. 'reply_id' => 0,  
  7. 'author_id' => 0,  
  8. 'revision_id' => 0 
  9. ), 'update_reply_revision_log' ); 
  10.  
  11. // Populate the variables 
  12. $r['reason'] = bbp_format_revision_reason( $r['reason'] ); 
  13. $r['reply_id'] = bbp_get_reply_id( $r['reply_id'] ); 
  14. $r['author_id'] = bbp_get_user_id ( $r['author_id'], false, true ); 
  15. $r['revision_id'] = (int) $r['revision_id']; 
  16.  
  17. // Get the logs and append the new one to those 
  18. $revision_log = bbp_get_reply_raw_revision_log( $r['reply_id'] ); 
  19. $revision_log[ $r['revision_id'] ] = array( 'author' => $r['author_id'], 'reason' => $r['reason'] ); 
  20.  
  21. // Finally, update 
  22. update_post_meta( $r['reply_id'], '_bbp_revision_log', $revision_log ); 
  23.  
  24. return apply_filters( 'bbp_update_reply_revision_log', $revision_log, $r['reply_id'] );