Changeset 6354
- Timestamp:
- 03/03/2017 03:58:52 AM (9 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/forums/template.php
r6352 r6354 1269 1269 * @param int $forum_id Optional. Topic id 1270 1270 * @uses bbp_get_forum_id() To get the forum id 1271 * @uses bbp_get_forum () To get the forum1271 * @uses bbp_get_forum_permalink() To get the forum permalink 1272 1272 * @uses bbp_get_forum_topic_count() To get the forum topic count 1273 * @uses bbp_get_forum_permalink() To get the forum permalink1274 1273 * @uses bbp_get_forum_topic_count_hidden() To get the forum hidden 1275 1274 * topic count … … 1280 1279 */ 1281 1280 function bbp_get_forum_topics_link( $forum_id = 0 ) { 1282 $forum = bbp_get_forum( $forum_id ); 1283 $forum_id = $forum->ID; 1284 $topics = sprintf( _n( '%s topic', '%s topics', bbp_get_forum_topic_count( $forum_id, true, false ), 'bbpress' ), bbp_get_forum_topic_count( $forum_id ) ); 1285 $retval = ''; 1281 $forum_id = bbp_get_forum_id( $forum_id ); 1282 $link = bbp_get_forum_permalink( $forum_id ); 1283 $topics = sprintf( _n( '%s topic', '%s topics', bbp_get_forum_topic_count( $forum_id, true, true ), 'bbpress' ), bbp_get_forum_topic_count( $forum_id, true, false ) ); 1286 1284 1287 1285 // First link never has view=all 1288 if ( bbp_get_view_all( 'edit_others_topics' ) ) { 1289 $retval .= "<a href='" . esc_url( bbp_remove_view_all( bbp_get_forum_permalink( $forum_id ) ) ) . "'>" . esc_html( $topics ) . "</a>"; 1290 } else { 1291 $retval .= esc_html( $topics ); 1292 } 1286 $retval = bbp_get_view_all( 'edit_others_topics' ) 1287 ? "<a href='" . esc_url( bbp_remove_view_all( $link ) ) . "'>" . esc_html( $topics ) . "</a>" 1288 : esc_html( $topics ); 1293 1289 1294 1290 // Get deleted topics 1295 $deleted = bbp_get_forum_topic_count_hidden( $forum_id);1291 $deleted_int = bbp_get_forum_topic_count_hidden( $forum_id, true ); 1296 1292 1297 1293 // This forum has hidden topics 1298 if ( ! empty( $deleted ) && current_user_can( 'edit_others_topics' ) ) { 1299 1300 // Extra text 1301 $extra = ' ' . sprintf( _n( '(%d hidden)', '(%d hidden)', $deleted, 'bbpress' ), $deleted ); 1302 1303 // No link 1304 if ( bbp_get_view_all() ) { 1305 $retval .= " $extra"; 1306 1307 // Link 1308 } else { 1309 $retval .= " <a href='" . esc_url( bbp_add_view_all( bbp_get_forum_permalink( $forum_id ), true ) ) . "'>" . esc_html( $extra ) . "</a>"; 1310 } 1294 if ( ! empty( $deleted_int ) && current_user_can( 'edit_others_topics' ) ) { 1295 1296 // Hidden text 1297 $deleted_num = bbp_get_forum_topic_count_hidden( $forum_id, false ); 1298 $extra = ' ' . sprintf( _n( '(+%s hidden)', '(+%s hidden)', $deleted_int, 'bbpress' ), $deleted_num ); 1299 1300 // Hidden link 1301 $retval .= ! bbp_get_view_all() 1302 ? " <a href='" . esc_url( bbp_add_view_all( $link, true ) ) . "'>" . esc_html( $extra ) . "</a>" 1303 : " {$extra}"; 1311 1304 } 1312 1305 -
trunk/src/includes/topics/template.php
r6352 r6354 2211 2211 * @param int $topic_id Optional. Topic id 2212 2212 * @uses bbp_get_topic_id() To get the topic id 2213 * @uses bbp_get_topic () To get the topic2213 * @uses bbp_get_topic_permalink() To get the topic permalink 2214 2214 * @uses bbp_get_topic_reply_count() To get the topic reply count 2215 * @uses bbp_get_topic_permalink() To get the topic permalink2216 2215 * @uses bbp_get_topic_reply_count_hidden() To get the topic hidden 2217 2216 * reply count … … 2222 2221 */ 2223 2222 function bbp_get_topic_replies_link( $topic_id = 0 ) { 2224 2225 $topic = bbp_get_topic( $topic_id ); 2226 $topic_id = $topic->ID; 2227 $replies = sprintf( _n( '%s reply', '%s replies', bbp_get_topic_reply_count( $topic_id, true ), 'bbpress' ), bbp_get_topic_reply_count( $topic_id ) ); 2228 $retval = ''; 2223 $topic_id = bbp_get_topic_id( $topic_id ); 2224 $link = bbp_get_topic_permalink( $topic_id ); 2225 $replies = sprintf( _n( '%s reply', '%s replies', bbp_get_topic_reply_count( $topic_id, true ), 'bbpress' ), bbp_get_topic_reply_count( $topic_id, false ) ); 2229 2226 2230 2227 // First link never has view=all 2231 if ( bbp_get_view_all( 'edit_others_replies' ) ) { 2232 $retval .= "<a href='" . esc_url( bbp_remove_view_all( bbp_get_topic_permalink( $topic_id ) ) ) . "'>" . esc_html( $replies ) . "</a>"; 2233 } else { 2234 $retval .= $replies; 2235 } 2228 $retval = bbp_get_view_all( 'edit_others_replies' ) 2229 ? "<a href='" . esc_url( bbp_remove_view_all( $link ) ) . "'>" . esc_html( $replies ) . "</a>" 2230 : $replies; 2236 2231 2237 2232 // Any deleted replies? 2238 $deleted = bbp_get_topic_reply_count_hidden( $topic_id ); 2239 2240 // This forum has hidden topics 2241 if ( ! empty( $deleted ) && current_user_can( 'edit_others_replies' ) ) { 2242 2243 // Extra text 2244 $extra = ' ' . sprintf( _n( '(%d hidden)', '(%d hidden)', $deleted, 'bbpress' ), $deleted ); 2245 2246 // No link 2247 if ( bbp_get_view_all() ) { 2248 $retval .= " $extra"; 2249 2250 // Link 2251 } else { 2252 $retval .= " <a href='" . esc_url( bbp_add_view_all( bbp_get_topic_permalink( $topic_id ), true ) ) . "'>" . esc_html( $extra ) . "</a>"; 2253 } 2233 $deleted_int = bbp_get_topic_reply_count_hidden( $topic_id, true ); 2234 2235 // This topic has hidden replies 2236 if ( ! empty( $deleted_int ) && current_user_can( 'edit_others_replies' ) ) { 2237 2238 // Hidden replies 2239 $deleted_num = bbp_get_topic_reply_count_hidden( $topic_id, false ); 2240 $extra = ' ' . sprintf( _n( '(+%s hidden)', '(+%s hidden)', $deleted_int, 'bbpress' ), $deleted_num ); 2241 2242 // Hidden link 2243 $retval .= ! bbp_get_view_all() 2244 ? " <a href='" . esc_url( bbp_add_view_all( $link, true ) ) . "'>" . esc_html( $extra ) . "</a>" 2245 : " {$extra}"; 2254 2246 } 2255 2247
Note: See TracChangeset
for help on using the changeset viewer.