bbp_get_reply_spam_link( mixed $args = '' )

Return the spam link of the reply

Description

Parameters

$args

(Optional) This function supports these arguments: - id: Reply id - link_before: HTML before the link - link_after: HTML after the link - spam_text: Spam text - unspam_text: Unspam text

Default value: ''

Return

(string) Reply spam link

Source

File: bp-forums/replies/template.php

2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
function bbp_get_reply_spam_link( $args = '' ) {
 
    // Parse arguments against default values
    $r = bbp_parse_args( $args, array(
        'id'           => 0,
        'link_before'  => '',
        'link_after'   => '',
        'spam_text'    => esc_html__( 'Spam',   'buddyboss' ),
        'unspam_text'  => esc_html__( 'Unspam', 'buddyboss' )
    ), 'get_reply_spam_link' );
 
    $reply = bbp_get_reply( bbp_get_reply_id( (int) $r['id'] ) );
 
    if ( empty( $reply ) || !current_user_can( 'moderate', $reply->ID ) )
        return;
 
    $display  = bbp_is_reply_spam( $reply->ID ) ? $r['unspam_text'] : $r['spam_text'];
    $uri      = add_query_arg( array( 'action' => 'bbp_toggle_reply_spam', 'reply_id' => $reply->ID ) );
    $uri      = wp_nonce_url( $uri, 'spam-reply_' . $reply->ID );
    $retval   = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-reply-spam-link">' . $display . '</a>' . $r['link_after'];
 
    return apply_filters( 'bbp_get_reply_spam_link', $retval, $r );
}

Changelog

Changelog
Version Description
bbPress (r2740) 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.