bbp_get_form_forum_subscribed()
Return checked value of forum subscription
Description
Return
(string) Checked value of forum subscription
Source
File: bp-forums/forums/template.php
function bbp_get_form_forum_subscribed() {
// Get _POST data
if ( bbp_is_post_request() && isset( $_POST['bbp_forum_subscription'] ) ) {
$forum_subscribed = (bool) $_POST['bbp_forum_subscription'];
// Get edit data
} elseif ( bbp_is_forum_edit() || bbp_is_reply_edit() ) {
// Get current posts author
$post_author = bbp_get_global_post_field( 'post_author', 'raw' );
// Post author is not the current user
if ( bbp_get_current_user_id() !== $post_author ) {
$forum_subscribed = bbp_is_user_subscribed_to_forum( $post_author );
// Post author is the current user
} else {
$forum_subscribed = bbp_is_user_subscribed_to_forum( bbp_get_current_user_id() );
}
// Get current status
} elseif ( bbp_is_single_forum() ) {
$forum_subscribed = bbp_is_user_subscribed_to_forum( bbp_get_current_user_id() );
// No data
} else {
$forum_subscribed = false;
}
// Get checked output
$checked = checked( $forum_subscribed, true, false );
return apply_filters( 'bbp_get_form_forum_subscribed', $checked, $forum_subscribed );
}
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.