bbp_remove_forum_from_all_subscriptions( int $forum_id )
Remove a deleted forum from all users’ subscriptions
Description
Parameters
- $forum_id
-
(Required) Get the forum ID to remove
Source
File: bp-forums/forums/functions.php
function bbp_remove_forum_from_all_subscriptions( $forum_id = 0 ) { // Subscriptions are not active if ( ! bbp_is_subscriptions_active() ) { return; } $forum_id = bbp_get_forum_id( $forum_id ); // Bail if no forum if ( empty( $forum_id ) ) { return; } // Get users $users = (array) bbp_get_forum_subscribers( $forum_id ); // Users exist if ( !empty( $users ) ) { // Loop through users foreach ( $users as $user ) { // Remove each user bbp_remove_user_subscription( $user, $forum_id ); } } }
Changelog
Version | Description |
---|---|
bbPress (r5156) | 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.