bbp_topic_notices()
Displays topic notices
Description Description
Source Source
File: includes/topics/template.php
function bbp_topic_notices() {
// Bail if not viewing a topic
if ( ! bbp_is_single_topic() ) {
return;
}
// Get the topic_status
$topic_status = bbp_get_topic_status();
// Get the topic status
switch ( $topic_status ) {
// Spam notice
case bbp_get_spam_status_id() :
$notice_text = esc_html__( 'This topic is marked as spam.', 'bbpress' );
break;
// Trashed notice
case bbp_get_trash_status_id() :
$notice_text = esc_html__( 'This topic is in the trash.', 'bbpress' );
break;
// Pending notice
case bbp_get_pending_status_id() :
$notice_text = esc_html__( 'This topic is pending moderation.', 'bbpress' );
break;
// Standard status
default :
$notice_text = '';
break;
}
// Filter notice text and bail if empty
$notice_text = apply_filters( 'bbp_topic_notices', $notice_text, $topic_status, bbp_get_topic_id() );
if ( empty( $notice_text ) ) {
return;
}
bbp_add_error( 'topic_notice', $notice_text, 'message' );
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |