bbp_update_topic_revision_log

Update the revision log of the topic.

Description

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

Parameters (1)

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

Usage

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

Defined (1)

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

/includes/topics/functions.php  
  1. function bbp_update_topic_revision_log( $args = '' ) { 
  2.  
  3. // Parse arguments against default values 
  4. $r = bbp_parse_args( $args, array( 
  5. 'reason' => '',  
  6. 'topic_id' => 0,  
  7. 'author_id' => 0,  
  8. 'revision_id' => 0 
  9. ), 'update_topic_revision_log' ); 
  10.  
  11. // Populate the variables 
  12. $r['reason'] = bbp_format_revision_reason( $r['reason'] ); 
  13. $r['topic_id'] = bbp_get_topic_id( $r['topic_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_topic_raw_revision_log( $r['topic_id'] ); 
  19. $revision_log[ $r['revision_id'] ] = array( 'author' => $r['author_id'], 'reason' => $r['reason'] ); 
  20.  
  21. // Finally, update 
  22. return update_post_meta( $r['topic_id'], '_bbp_revision_log', $revision_log );