bbp_get_topic_spam_link( mixed $args = '' )
Return the spam link of the topic
Description
Parameters
- $args
-
(Optional) This function supports these args: - id: Optional. Topic id - link_before: Before the link - link_after: After the link - spam_text: Spam text - unspam_text: Unspam text
Default value: ''
Return
(string) Topic spam link
Source
File: bp-forums/topics/template.php
3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 | function bbp_get_topic_spam_link( $args = '' ) { // Parse arguments against default values $r = bbp_parse_args( $args , array ( 'id' => 0, 'link_before' => '' , 'link_after' => '' , 'sep' => ' | ' , 'spam_text' => esc_html__( 'Spam' , 'buddyboss' ), 'unspam_text' => esc_html__( 'Unspam' , 'buddyboss' ) ), 'get_topic_spam_link' ); $topic = bbp_get_topic( bbp_get_topic_id( (int) $r [ 'id' ] ) ); if ( empty ( $topic ) || !current_user_can( 'moderate' , $topic ->ID ) ) return ; $display = bbp_is_topic_spam( $topic ->ID ) ? $r [ 'unspam_text' ] : $r [ 'spam_text' ]; $uri = add_query_arg( array ( 'action' => 'bbp_toggle_topic_spam' , 'topic_id' => $topic ->ID ) ); $uri = wp_nonce_url( $uri , 'spam-topic_' . $topic ->ID ); $retval = $r [ 'link_before' ] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-spam-link">' . $display . '</a>' . $r [ 'link_after' ]; return apply_filters( 'bbp_get_topic_spam_link' , $retval , $r ); } |
Changelog
Version | Description |
---|---|
bbPress (r2727) | 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.