bbp_topic_notices()

Displays topic notices

Description

Source

File: bp-forums/topics/template.php

3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
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 = __( 'This topic is marked as spam.', 'buddyboss' );
            break;
 
        // Trashed notice
        case bbp_get_trash_status_id() :
            $notice_text = __( 'This topic is in the trash.',   'buddyboss' );
            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
bbPress (r2744) 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.