bbp_get_topic_trash_link( mixed $args = '' )
Return the trash 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 - sep: Links separator - trash_text: Trash text - restore_text: Restore text - delete_text: Delete text
Default value: ''
Return
(string) Topic trash link
Source
File: bp-forums/topics/template.php
2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 | function bbp_get_topic_trash_link( $args = '' ) { // Parse arguments against default values $r = bbp_parse_args( $args , array ( 'id' => 0, 'link_before' => '' , 'link_after' => '' , 'sep' => ' | ' , 'trash_text' => esc_html__( 'Trash' , 'buddyboss' ), 'restore_text' => esc_html__( 'Restore' , 'buddyboss' ), 'delete_text' => esc_html__( 'Delete' , 'buddyboss' ) ), 'get_topic_trash_link' ); $actions = array (); $topic = bbp_get_topic( bbp_get_topic_id( (int) $r [ 'id' ] ) ); if ( empty ( $topic ) || !current_user_can( 'delete_topic' , $topic ->ID ) ) { return ; } if ( bbp_is_topic_trash( $topic ->ID ) ) { $actions [ 'untrash' ] = '<a title="' . esc_attr__( 'Restore this item from the Trash' , 'buddyboss' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array ( 'action' => 'bbp_toggle_topic_trash' , 'sub_action' => 'untrash' , 'topic_id' => $topic ->ID ) ), 'untrash-' . $topic ->post_type . '_' . $topic ->ID ) ) . '" class="bbp-topic-restore-link">' . $r [ 'restore_text' ] . '</a>' ; } elseif ( EMPTY_TRASH_DAYS ) { $actions [ 'trash' ] = '<a title="' . esc_attr__( 'Move this item to the Trash' , 'buddyboss' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array ( 'action' => 'bbp_toggle_topic_trash' , 'sub_action' => 'trash' , 'topic_id' => $topic ->ID ) ), 'trash-' . $topic ->post_type . '_' . $topic ->ID ) ) . '" class="bbp-topic-trash-link">' . $r [ 'trash_text' ] . '</a>' ; } if ( bbp_is_topic_trash( $topic ->ID ) || !EMPTY_TRASH_DAYS ) { $actions [ 'delete' ] = '<a title="' . esc_attr__( 'Delete this item permanently' , 'buddyboss' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array ( 'action' => 'bbp_toggle_topic_trash' , 'sub_action' => 'delete' , 'topic_id' => $topic ->ID ) ), 'delete-' . $topic ->post_type . '_' . $topic ->ID ) ) . '" onclick="return confirm(\'' . esc_js( __( 'Are you sure you want to delete that permanently?' , 'buddyboss' ) ) . '\' );" class="bbp-topic-delete-link">' . $r [ 'delete_text' ] . '</a>' ; } // Process the admin links $retval = $r [ 'link_before' ] . implode( $r [ 'sep' ], $actions ) . $r [ 'link_after' ]; return apply_filters( 'bbp_get_topic_trash_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.