Changeset 5675
- Timestamp:
- 04/15/2015 02:16:32 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/includes/replies/template.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/replies/template.php
r5588 r5675 1684 1684 1685 1685 // Get the reply to use it's ID and post_parent 1686 $reply = bbp_get_reply( bbp_get_reply_id( (int)$r['id'] ) );1686 $reply = bbp_get_reply( bbp_get_reply_id( $r['id'] ) ); 1687 1687 1688 1688 // Bail if no reply or user cannot reply … … 1880 1880 ), 'get_reply_admin_links' ); 1881 1881 1882 $r['id'] = bbp_get_reply_id( (int)$r['id'] );1882 $r['id'] = bbp_get_reply_id( $r['id'] ); 1883 1883 1884 1884 // If post is a topic, return the topic admin links instead … … 1888 1888 1889 1889 // If post is not a reply, return 1890 if ( ! bbp_is_reply( $r['id'] ) ) {1890 if ( ! bbp_is_reply( $r['id'] ) ) { 1891 1891 return; 1892 1892 } … … 1972 1972 ), 'get_reply_edit_link' ); 1973 1973 1974 $reply = bbp_get_reply( bbp_get_reply_id( (int)$r['id'] ) );1974 $reply = bbp_get_reply( bbp_get_reply_id( $r['id'] ) ); 1975 1975 1976 1976 // Bypass check if user has caps 1977 if ( ! current_user_can( 'edit_others_replies' ) ) {1977 if ( ! current_user_can( 'edit_others_replies' ) ) { 1978 1978 1979 1979 // User cannot edit or it is past the lock time 1980 if ( empty( $reply ) || ! current_user_can( 'edit_reply', $reply->ID ) || bbp_past_edit_lock( $reply->post_date_gmt ) ) {1980 if ( empty( $reply ) || ! current_user_can( 'edit_reply', $reply->ID ) || bbp_past_edit_lock( $reply->post_date_gmt ) ) { 1981 1981 return; 1982 1982 } … … 1993 1993 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-reply-edit-link">' . $r['edit_text'] . '</a>' . $r['link_after']; 1994 1994 1995 return apply_filters( 'bbp_get_reply_edit_link', $retval, $r );1995 return apply_filters( 'bbp_get_reply_edit_link', $retval, $r, $args ); 1996 1996 } 1997 1997 … … 2024 2024 global $wp_rewrite; 2025 2025 2026 $bbp = bbpress();2027 2026 $reply = bbp_get_reply( bbp_get_reply_id( $reply_id ) ); 2028 2027 if ( empty( $reply ) ) { … … 2034 2033 // Pretty permalinks 2035 2034 if ( $wp_rewrite->using_permalinks() ) { 2036 $url = trailingslashit( $reply_link ) . $bbp->edit_id;2035 $url = trailingslashit( $reply_link ) . bbp_get_edit_rewrite_id(); 2037 2036 $url = trailingslashit( $url ); 2038 2037 2039 2038 // Unpretty permalinks 2040 2039 } else { 2041 $url = add_query_arg( array( bbp_get_reply_post_type() => $reply->post_name, $bbp->edit_id=> '1' ), $reply_link );2040 $url = add_query_arg( array( bbp_get_reply_post_type() => $reply->post_name, bbp_get_edit_rewrite_id() => '1' ), $reply_link ); 2042 2041 } 2043 2042 … … 2100 2099 ), 'get_reply_trash_link' ); 2101 2100 2101 $reply = bbp_get_reply( bbp_get_reply_id( $r['id'] ) ); 2102 2103 if ( empty( $reply ) || ! current_user_can( 'delete_reply', $reply->ID ) ) { 2104 return; 2105 } 2106 2102 2107 $actions = array(); 2103 $reply = bbp_get_reply( bbp_get_reply_id( (int) $r['id'] ) );2104 2105 if ( empty( $reply ) || !current_user_can( 'delete_reply', $reply->ID ) ) {2106 return;2107 }2108 2108 2109 2109 if ( bbp_is_reply_trash( $reply->ID ) ) { … … 2120 2120 $retval = $r['link_before'] . implode( $r['sep'], $actions ) . $r['link_after']; 2121 2121 2122 return apply_filters( 'bbp_get_reply_trash_link', $retval, $r );2122 return apply_filters( 'bbp_get_reply_trash_link', $retval, $r, $args ); 2123 2123 } 2124 2124 … … 2170 2170 ), 'get_reply_spam_link' ); 2171 2171 2172 $reply = bbp_get_reply( bbp_get_reply_id( (int)$r['id'] ) );2173 2174 if ( empty( $reply ) || ! current_user_can( 'moderate', $reply->ID ) ) {2172 $reply = bbp_get_reply( bbp_get_reply_id( $r['id'] ) ); 2173 2174 if ( empty( $reply ) || ! current_user_can( 'moderate', $reply->ID ) ) { 2175 2175 return; 2176 2176 } 2177 2177 2178 $display = bbp_is_reply_spam( $reply->ID ) ? $r['unspam_text'] : $r['spam_text'];2179 $uri = add_query_arg( array( 'action' => 'bbp_toggle_reply_spam', 'reply_id' => $reply->ID ) );2180 $uri = wp_nonce_url( $uri, 'spam-reply_' . $reply->ID );2181 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-reply-spam-link">' . $display . '</a>' . $r['link_after'];2182 2183 return apply_filters( 'bbp_get_reply_spam_link', $retval, $r );2178 $display = bbp_is_reply_spam( $reply->ID ) ? $r['unspam_text'] : $r['spam_text']; 2179 $uri = add_query_arg( array( 'action' => 'bbp_toggle_reply_spam', 'reply_id' => $reply->ID ) ); 2180 $uri = wp_nonce_url( $uri, 'spam-reply_' . $reply->ID ); 2181 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-reply-spam-link">' . $display . '</a>' . $r['link_after']; 2182 2183 return apply_filters( 'bbp_get_reply_spam_link', $retval, $r, $args ); 2184 2184 } 2185 2185 … … 2238 2238 $topic_id = bbp_get_reply_topic_id( $reply_id ); 2239 2239 2240 if ( empty( $reply_id ) || ! current_user_can( 'moderate', $topic_id ) ) {2240 if ( empty( $reply_id ) || ! current_user_can( 'moderate', $topic_id ) ) { 2241 2241 return; 2242 2242 } … … 2249 2249 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" title="' . $r['split_title'] . '" class="bbp-reply-move-link">' . $r['split_text'] . '</a>' . $r['link_after']; 2250 2250 2251 return apply_filters( 'bbp_get_reply_move_link', $retval, $r );2251 return apply_filters( 'bbp_get_reply_move_link', $retval, $r, $args ); 2252 2252 } 2253 2253 … … 2306 2306 $topic_id = bbp_get_reply_topic_id( $reply_id ); 2307 2307 2308 if ( empty( $reply_id ) || ! current_user_can( 'moderate', $topic_id ) ) {2308 if ( empty( $reply_id ) || ! current_user_can( 'moderate', $topic_id ) ) { 2309 2309 return; 2310 2310 } 2311 2311 2312 $uri = add_query_arg( array(2312 $uri = add_query_arg( array( 2313 2313 'action' => 'split', 2314 2314 'reply_id' => $reply_id … … 2317 2317 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" title="' . $r['split_title'] . '" class="bbp-topic-split-link">' . $r['split_text'] . '</a>' . $r['link_after']; 2318 2318 2319 return apply_filters( 'bbp_get_topic_split_link', $retval, $r );2319 return apply_filters( 'bbp_get_topic_split_link', $retval, $r, $args ); 2320 2320 } 2321 2321 … … 2367 2367 ), 'get_reply_approve_link' ); 2368 2368 2369 $reply = bbp_get_reply( bbp_get_reply_id( (int)$r['id'] ) );2370 2371 if ( empty( $reply ) || ! current_user_can( 'moderate', $reply->ID ) ) {2369 $reply = bbp_get_reply( bbp_get_reply_id( $r['id'] ) ); 2370 2371 if ( empty( $reply ) || ! current_user_can( 'moderate', $reply->ID ) ) { 2372 2372 return; 2373 2373 } … … 2378 2378 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-reply-approve-link">' . $display . '</a>' . $r['link_after']; 2379 2379 2380 return apply_filters( 'bbp_get_reply_approve_link', $retval, $r );2380 return apply_filters( 'bbp_get_reply_approve_link', $retval, $r, $args ); 2381 2381 } 2382 2382
Note: See TracChangeset
for help on using the changeset viewer.