BBP_Replies_Admin::row_actions( array $actions, array $reply )
Reply Row actions
Description
Remove the quick-edit action link under the reply title and add the content and spam link
Parameters
- $actions
-
(Required) Actions
- $reply
-
(Required) Reply object
Return
(array) $actions Actions
Source
File: bp-forums/admin/replies.php
public function row_actions( $actions, $reply ) { if ( $this->bail() ) return $actions; unset( $actions['inline hide-if-no-js'] ); //simple hack to show the reply content bbp_reply_content( $reply->ID ); // Reply view links to topic $actions['view'] = '<a href="' . esc_url( bbp_get_reply_url( $reply->ID ) ) . '" title="' . esc_attr( sprintf( __( 'View "%s"', 'buddyboss' ), bbp_get_reply_title( $reply->ID ) ) ) . '" rel="permalink">' . esc_html__( 'View', 'buddyboss' ) . '</a>'; // User cannot view replies in trash if ( ( bbp_get_trash_status_id() === $reply->post_status ) && !current_user_can( 'view_trash' ) ) unset( $actions['view'] ); // Only show the actions if the user is capable of viewing them if ( current_user_can( 'moderate', $reply->ID ) ) { if ( in_array( $reply->post_status, array( bbp_get_public_status_id(), bbp_get_spam_status_id() ) ) ) { $spam_uri = wp_nonce_url( add_query_arg( array( 'reply_id' => $reply->ID, 'action' => 'bbp_toggle_reply_spam' ), remove_query_arg( array( 'bbp_reply_toggle_notice', 'reply_id', 'failed', 'super' ) ) ), 'spam-reply_' . $reply->ID ); if ( bbp_is_reply_spam( $reply->ID ) ) { $actions['spam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark the reply as not spam', 'buddyboss' ) . '">' . esc_html__( 'Not spam', 'buddyboss' ) . '</a>'; } else { $actions['spam'] = '<a href="' . esc_url( $spam_uri ) . '" title="' . esc_attr__( 'Mark this reply as spam', 'buddyboss' ) . '">' . esc_html__( 'Spam', 'buddyboss' ) . '</a>'; } } } // Trash if ( current_user_can( 'delete_reply', $reply->ID ) ) { if ( bbp_get_trash_status_id() === $reply->post_status ) { $post_type_object = get_post_type_object( bbp_get_reply_post_type() ); $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash', 'buddyboss' ) . "' href='" . esc_url( add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $reply->ID ) ), 'untrash-' . $reply->post_type . '_' . $reply->ID ) ) ) . "'>" . esc_html__( 'Restore', 'buddyboss' ) . "</a>"; } elseif ( EMPTY_TRASH_DAYS ) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash', 'buddyboss' ) . "' href='" . esc_url( add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $reply->ID ) ) ) . "'>" . esc_html__( 'Trash', 'buddyboss' ) . "</a>"; } if ( bbp_get_trash_status_id() === $reply->post_status || !EMPTY_TRASH_DAYS ) { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently', 'buddyboss' ) . "' href='" . esc_url( add_query_arg( array( '_wp_http_referer' => add_query_arg( array( 'post_type' => bbp_get_reply_post_type() ), admin_url( 'edit.php' ) ) ), get_delete_post_link( $reply->ID, '', true ) ) ) . "'>" . esc_html__( 'Delete Permanently', 'buddyboss' ) . "</a>"; } elseif ( bbp_get_spam_status_id() === $reply->post_status ) { unset( $actions['trash'] ); } } return $actions; }
Changelog
Version | Description |
---|---|
bbPress (r2577) | 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.