BP_REST_Reply_Endpoint::get_reply_current_user_permissions( integer $reply_id )

Get current user permission for reply.

Description

Parameters

$reply_id

(integer) (Required) Reply ID.

Return

(array|void)

Source

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

	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.