Changeset 6433 for trunk/src/includes/replies/template.php
- Timestamp:
- 05/26/2017 09:50:36 PM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/replies/template.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/replies/template.php
r6415 r6433 1706 1706 1707 1707 // Get the reply to use it's ID and post_parent 1708 $reply = bbp_get_reply( $r['id'] ); 1708 $reply = bbp_get_reply( $r['id'] ); 1709 $topic_id = bbp_get_reply_topic_id( $reply->ID ); 1709 1710 1710 1711 // Bail if no reply or user cannot reply 1711 if ( empty( $reply ) || ! bbp_current_user_can_access_create_reply_form() ) {1712 if ( empty( $reply ) || empty( $topic_id ) || bbp_is_single_reply() || ! bbp_current_user_can_access_create_reply_form() ) { 1712 1713 return; 1713 1714 } … … 1740 1741 // Add $uri to the array, to be passed through the filter 1741 1742 $r['uri'] = $uri; 1742 $retval = $r['link_before'] . '<a role="button" href="' . esc_url( $r['uri'] ) . '" class="bbp-reply-to-link"' . $onclick . '>' . esc_html( $r['reply_text'] ). '</a>' . $r['link_after'];1743 $retval = $r['link_before'] . '<a role="button" href="' . esc_url( $r['uri'] ) . '" class="bbp-reply-to-link"' . $onclick . '>' . $r['reply_text'] . '</a>' . $r['link_after']; 1743 1744 1744 1745 return apply_filters( 'bbp_get_reply_to_link', $retval, $r, $args ); … … 1774 1775 // Set default text 1775 1776 if ( empty( $text ) ) { 1776 $text = __( 'Cancel', 'bbpress' );1777 $text = esc_html__( 'Cancel', 'bbpress' ); 1777 1778 } 1778 1779 … … 1997 1998 ), 'get_reply_edit_link' ); 1998 1999 2000 // Get reply 1999 2001 $reply = bbp_get_reply( $r['id'] ); 2000 2002 … … 2048 2050 function bbp_get_reply_edit_url( $reply_id = 0 ) { 2049 2051 2052 // Bail if no reply 2050 2053 $reply = bbp_get_reply( $reply_id ); 2051 2054 if ( empty( $reply ) ) { … … 2127 2130 ), 'get_reply_trash_link' ); 2128 2131 2132 // Get reply 2129 2133 $reply = bbp_get_reply( $r['id'] ); 2130 2134 2135 // Bail if no reply or current user cannot delete 2131 2136 if ( empty( $reply ) || ! current_user_can( 'delete_reply', $reply->ID ) ) { 2132 2137 return; 2133 2138 } 2134 2139 2135 $actions = array(); 2136 2140 $actions = array(); 2141 $trash_days = bbp_get_trash_days( bbp_get_reply_post_type() ); 2142 2143 // Trashed 2137 2144 if ( bbp_is_reply_trash( $reply->ID ) ) { 2138 2145 $actions['untrash'] = '<a title="' . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_reply_trash', 'sub_action' => 'untrash', 'reply_id' => $reply->ID ) ), 'untrash-' . $reply->post_type . '_' . $reply->ID ) ) . '" class="bbp-reply-restore-link">' . $r['restore_text'] . '</a>'; 2139 } elseif ( EMPTY_TRASH_DAYS ) { 2146 2147 // Trash 2148 } elseif ( ! empty( $trash_days ) ) { 2140 2149 $actions['trash'] = '<a title="' . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_reply_trash', 'sub_action' => 'trash', 'reply_id' => $reply->ID ) ), 'trash-' . $reply->post_type . '_' . $reply->ID ) ) . '" class="bbp-reply-trash-link">' . $r['trash_text'] . '</a>'; 2141 2150 } 2142 2151 2143 if ( bbp_is_reply_trash( $reply->ID ) || !EMPTY_TRASH_DAYS ) { 2152 // No trash 2153 if ( bbp_is_reply_trash( $reply->ID ) || empty( $trash_days ) ) { 2144 2154 $actions['delete'] = '<a title="' . esc_attr__( 'Delete this item permanently', 'bbpress' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'bbp_toggle_reply_trash', 'sub_action' => 'delete', 'reply_id' => $reply->ID ) ), 'delete-' . $reply->post_type . '_' . $reply->ID ) ) . '" onclick="return confirm(\'' . esc_js( __( 'Are you sure you want to delete that permanently?', 'bbpress' ) ) . '\' );" class="bbp-reply-delete-link">' . $r['delete_text'] . '</a>'; 2145 2155 } … … 2198 2208 ), 'get_reply_spam_link' ); 2199 2209 2210 // Get reply 2200 2211 $reply = bbp_get_reply( $r['id'] ); 2201 2212 2213 // Bail if no reply or current user cannot moderate 2202 2214 if ( empty( $reply ) || ! current_user_can( 'moderate', $reply->ID ) ) { 2203 2215 return; … … 2263 2275 ), 'get_reply_move_link' ); 2264 2276 2277 // Get IDs 2265 2278 $reply_id = bbp_get_reply_id( $r['id'] ); 2266 2279 $topic_id = bbp_get_reply_topic_id( $reply_id ); 2267 2280 2281 // Bail if no reply ID or user cannot moderate 2268 2282 if ( empty( $reply_id ) || ! current_user_can( 'moderate', $topic_id ) ) { 2269 2283 return; … … 2331 2345 ), 'get_topic_split_link' ); 2332 2346 2347 // Get IDs 2333 2348 $reply_id = bbp_get_reply_id( $r['id'] ); 2334 2349 $topic_id = bbp_get_reply_topic_id( $reply_id ); 2335 2350 2336 if ( empty( $reply_id ) || ! current_user_can( 'moderate', $topic_id ) ) { 2351 // Bail if no reply/topic ID, or user cannot moderate 2352 if ( empty( $reply_id ) || empty( $topic_id ) || ! current_user_can( 'moderate', $topic_id ) ) { 2337 2353 return; 2338 2354 } … … 2395 2411 ), 'get_reply_approve_link' ); 2396 2412 2413 // Get reply 2397 2414 $reply = bbp_get_reply( $r['id'] ); 2398 2415 2416 // Bail if no reply or current user cannot moderate 2399 2417 if ( empty( $reply ) || ! current_user_can( 'moderate', $reply->ID ) ) { 2400 2418 return; … … 2856 2874 } 2857 2875 2858 // Used variables2859 $tab = ! empty( $r['tab'] ) ? ' tabindex="' . (int) $r['tab'] . '"' : '';2860 2861 2876 // Start an output buffer, we'll finish it after the select loop 2862 2877 ob_start(); ?> 2863 2878 2864 <select name="<?php echo esc_attr( $r['select_id'] ) ?>" id="<?php echo esc_attr( $r['select_id'] ); ?>_select" class="<?php echo esc_attr( $r['select_class'] ); ?>"<?php echo $tab; ?>>2879 <select name="<?php echo esc_attr( $r['select_id'] ) ?>" id="<?php echo esc_attr( $r['select_id'] ); ?>_select" class="<?php echo esc_attr( $r['select_class'] ); ?>"<?php bbp_tab_index_attribute( $r['tab'] ); ?>> 2865 2880 2866 2881 <?php foreach ( bbp_get_reply_statuses( $r['reply_id'] ) as $key => $label ) : ?>
Note: See TracChangeset
for help on using the changeset viewer.