BP_REST_Forums_Endpoint::get_forum_action_states( int $forum_id )
Get forum action states based on current user.
Description
Parameters
- $forum_id
-
(Required) ID of the forum.
Return
(array|void)
Source
File: bp-forums/classes/class-bp-rest-forums-endpoint.php
public function get_forum_action_states( $forum_id ) { if ( empty( $forum_id ) ) { return; } $forum_id = (int) $forum_id; $user_id = bbp_get_user_id( 0, true, true ); $state = array( 'subscribed' => false, ); if ( bbp_is_subscriptions_active() && current_user_can( 'edit_user', $user_id ) ) { $state['subscribed'] = bbp_is_user_subscribed( $user_id, $forum_id ); } return $state; }
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.