bbp_get_reply( int|object $reply, string $output = OBJECT, string $filter = 'raw' )

Gets a reply

Description

Parameters

$reply

(Required) reply id or reply object

$output

(Optional) OBJECT, ARRAY_A, or ARRAY_N. Default = OBJECT

Default value: OBJECT

$filter

(Optional) Sanitation filter. See sanitize_post()

Default value: 'raw'

Return

(mixed) Null if error or reply (in specified form) if success

Source

File: bp-forums/replies/template.php

403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
function bbp_get_reply( $reply, $output = OBJECT, $filter = 'raw' ) {
    if ( empty( $reply ) || is_numeric( $reply ) )
        $reply = bbp_get_reply_id( $reply );
 
    $reply = get_post( $reply, OBJECT, $filter );
    if ( empty( $reply ) )
        return $reply;
 
    if ( $reply->post_type !== bbp_get_reply_post_type() )
        return null;
 
    if ( $output === OBJECT ) {
        return $reply;
 
    } elseif ( $output === ARRAY_A ) {
        $_reply = get_object_vars( $reply );
        return $_reply;
 
    } elseif ( $output === ARRAY_N ) {
        $_reply = array_values( get_object_vars( $reply ) );
        return $_reply;
 
    }
 
    return apply_filters( 'bbp_get_reply', $reply, $output, $filter );
}

Changelog

Changelog
Version Description
bbPress (r2787) 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.