BP_REST_Topics_Endpoint::get_topic_current_user_permissions( int $topic_id )
Topic permissions for the current user.
Description
Parameters
- $topic_id
-
(Required) ID of the topic.
Return
(array|void)
Source
File: bp-forums/classes/class-bp-rest-topics-endpoint.php
2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 | public function get_topic_current_user_permissions( $topic_id ) { if ( empty ( $topic_id ) ) { return ; } $topic = bbp_get_topic( bbp_get_topic_id( (int) $topic_id ) ); $form_id = bbp_get_topic_forum_id( $topic_id ); return array ( 'show_replies' => $this ->forum_endpoint->can_access_content( $form_id ), 'edit' => ( current_user_can( 'moderate' ) || ( ! empty ( $topic ) && current_user_can( 'edit_topic' , $topic ->ID ) && ! bbp_past_edit_lock( $topic ->post_date_gmt ) ) ), 'moderate' => ! empty ( $topic ) && current_user_can( 'moderate' , $topic_id ), 'reply' => ! empty ( $topic ) && bbp_current_user_can_publish_replies() && $this ->forum_endpoint->can_access_content( $form_id , true ), 'trash' => ! empty ( $topic ) && current_user_can( 'delete_topic' , $topic ->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.