bbp_update_topic_revision_log( mixed $args = '' )

Update the revision log of the topic

Description

Parameters

$args

(Optional) Supports these args: - topic_id: Topic id - author_id: Author id - reason: Reason for editing - revision_id: Revision id

Default value: ''

Return

(mixed) False on failure, true on success

Source

File: bp-forums/topics/functions.php

2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
function bbp_update_topic_revision_log( $args = '' ) {
 
    // Parse arguments against default values
    $r = bbp_parse_args( $args, array(
        'reason'      => '',
        'topic_id'    => 0,
        'author_id'   => 0,
        'revision_id' => 0
    ), 'update_topic_revision_log' );
 
    // Populate the variables
    $r['reason']      = bbp_format_revision_reason( $r['reason'] );
    $r['topic_id']    = bbp_get_topic_id( $r['topic_id'] );
    $r['author_id']   = bbp_get_user_id ( $r['author_id'], false, true );
    $r['revision_id'] = (int) $r['revision_id'];
 
    // Get the logs and append the new one to those
    $revision_log                      = bbp_get_topic_raw_revision_log( $r['topic_id'] );
    $revision_log[ $r['revision_id'] ] = array( 'author' => $r['author_id'], 'reason' => $r['reason'] );
 
    // Finally, update
    return update_post_meta( $r['topic_id'], '_bbp_revision_log', $revision_log );
}

Changelog

Changelog
Version Description
bbPress (r2782) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.