Changeset 5835
- Timestamp:
- 07/15/2015 04:30:34 PM (10 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/forums.php
r5834 r5835 696 696 697 697 case 'bbp_forum_mods' : 698 $moderators = wp_get_object_terms( $forum_id, bbp_get_forum_mod_tax_id() ); 699 if ( empty( $moderators ) ) { 700 esc_html__( 'None', 'bbpress' ); 701 } else { 702 echo implode( ', ', wp_list_pluck( $moderators, 'name' ) ); 703 } 698 bbp_forum_mod_list( $forum_id, array( 699 'before' => '', 700 'after' => '', 701 'none' => esc_html__( '—', 'bbpress' ) 702 ) ); 704 703 break; 705 704 -
trunk/src/includes/forums/template.php
r5834 r5835 2231 2231 * Output a the moderators of a forum 2232 2232 * 2233 * @since bbPress (r5834) 2234 * 2233 2235 * @param int $forum_id Optional. Topic id 2234 2236 * @param array $args See {@link bbp_get_forum_mod_list()} … … 2240 2242 /** 2241 2243 * Return the moderators of a forum 2244 * 2245 * @since bbPress (r5834) 2242 2246 * 2243 2247 * @param int $forum_id Optional. Forum id … … 2255 2259 // Bail if forum-mods are off 2256 2260 if ( ! bbp_allow_forum_mods() ) { 2257 return ;2261 return ''; 2258 2262 } 2259 2263 … … 2262 2266 'before' => '<div class="bbp-forum-mods"><p>' . esc_html__( 'Moderators:', 'bbpress' ) . ' ', 2263 2267 'sep' => ', ', 2264 'after' => '</p></div>' 2268 'after' => '</p></div>', 2269 'none' => '' 2265 2270 ), 'get_forum_mod_list' ); 2266 2271 2272 // Bail if forum ID is invalid 2267 2273 $forum_id = bbp_get_forum_id( $forum_id ); 2268 2269 $retval = get_the_term_list( $forum_id, bbp_get_forum_mod_id(), $r['before'], $r['sep'], $r['after'] ); 2274 if ( empty( $forum_id ) ) { 2275 return ''; 2276 } 2277 2278 // Get forum moderators 2279 $moderators = wp_get_object_terms( $forum_id, bbp_get_forum_mod_tax_id() ); 2280 if ( ! empty( $moderators ) ) { 2281 2282 // In admin, use nicenames 2283 if ( is_admin() ) { 2284 2285 // @todo link to filtering forums by moderator 2286 $users = wp_list_pluck( $moderators, 'name' ); 2287 2288 // In theme, use display names & profile links 2289 } else { 2290 $users = array(); 2291 $term_ids = wp_list_pluck( $moderators, 'term_id' ); 2292 foreach ( $term_ids as $term_id ) { 2293 $user_id = bbp_get_term_taxonomy_user_id( $term_id ); 2294 $users[] = bbp_get_user_profile_link( $user_id ); 2295 } 2296 } 2297 2298 $retval = $r['before'] . implode( $r['sep'], $users ) . $r['after']; 2299 2300 // No forum moderators 2301 } else { 2302 $retval = $r['none']; 2303 } 2270 2304 2271 2305 return $retval; -
trunk/src/includes/topics/template.php
r5827 r5835 2358 2358 * Output a the tags of a topic 2359 2359 * 2360 * @since bbPress (r2688) 2361 * 2360 2362 * @param int $topic_id Optional. Topic id 2361 2363 * @param array $args See {@link bbp_get_topic_tag_list()} … … 2367 2369 /** 2368 2370 * Return the tags of a topic 2371 * 2372 * @since bbPress (r2688) 2369 2373 * 2370 2374 * @param int $topic_id Optional. Topic id … … 2381 2385 // Bail if topic-tags are off 2382 2386 if ( ! bbp_allow_topic_tags() ) { 2383 return ;2387 return ''; 2384 2388 } 2385 2389 … … 2388 2392 'before' => '<div class="bbp-topic-tags"><p>' . esc_html__( 'Tagged:', 'bbpress' ) . ' ', 2389 2393 'sep' => ', ', 2390 'after' => '</p></div>' 2394 'after' => '</p></div>', 2395 'none' => '' 2391 2396 ), 'get_topic_tag_list' ); 2392 2397 … … 2399 2404 $terms = get_post_meta( $topic_id, '_bbp_spam_topic_tags', true ); 2400 2405 2401 // If terms exist, explode them and compile the return value2406 // If terms exist, implode them and compile the return value 2402 2407 if ( ! empty( $terms ) ) { 2403 2408 $terms = implode( $r['sep'], $terms ); 2404 2409 $retval = $r['before'] . $terms . $r['after']; 2405 2406 // No terms so return emty string2407 } else {2408 $retval = '';2409 2410 } 2410 2411 2411 2412 // Topic is not spam so display a clickable term list 2412 2413 } else { 2413 $retval = get_the_term_list( $topic_id, bbp_get_topic_tag_tax_id(), $r['before'], $r['sep'], $r['after'] ); 2414 $terms = get_the_term_list( $topic_id, bbp_get_topic_tag_tax_id(), $r['before'], $r['sep'], $r['after'] ); 2415 } 2416 2417 // No terms so return none string 2418 if ( empty( $terms ) ) { 2419 $retval = $r['none']; 2414 2420 } 2415 2421
Note: See TracChangeset
for help on using the changeset viewer.