BP_REST_Reply_Endpoint::get_reply_current_user_permissions( integer $reply_id )

Get current user permission for reply.

Description

Parameters

$reply_id

(Required) Reply ID.

Return

(array|void)

Source

File: bp-forums/classes/class-bp-rest-reply-endpoint.php

2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
protected function get_reply_current_user_permissions( $reply_id ) {
 
    if ( empty( $reply_id ) ) {
        return;
    }
 
    // Get reply.
    $reply = bbp_get_reply( $reply_id );
 
    return array(
        'edit'  => (
            current_user_can( 'edit_others_replies' ) ||
            (
                ! empty( $reply_id ) &&
                current_user_can( 'edit_reply', $reply_id ) &&
                ! bbp_past_edit_lock( $reply->post_date_gmt )
            )
        ),
        'move'  => ! empty( $reply ) && current_user_can( 'moderate', $reply_id ),
        'split' => ! empty( $reply ) && current_user_can( 'moderate', $reply_id ),
        'spam'  => ! empty( $reply ) && current_user_can( 'moderate', $reply_id ),
        'trash' => ! empty( $reply ) && current_user_can( 'delete_reply', $reply_id ),
    );
}

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.