Changeset 1922 for trunk/bb-includes/functions.bb-topic-tags.php
- Timestamp:
- 01/20/2009 02:09:24 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/bb-includes/functions.bb-topic-tags.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-includes/functions.bb-topic-tags.php
r1851 r1922 381 381 } 382 382 } 383 384 385 386 387 388 389 // TODO 390 function bb_related_tags( $_tag = false, $number = 40 ) { 391 return array(); 392 393 global $bbdb, $tag; 394 if ( false === $_tag ) 395 $_tag = $tag; 396 else 397 $_tag = bb_get_tag( $_tag ); 398 399 if ( !$_tag ) 400 return false; 401 402 $number = (int) $number; 403 404 $sql = $bbdb->prepare( 405 "SELECT tag.tag_id, tag.tag, tag.raw_tag, COUNT(DISTINCT t.topic_id) AS tag_count 406 FROM $bbdb->tagged AS t 407 JOIN $bbdb->tagged AS tt ON (t.topic_id = tt.topic_id) 408 JOIN $bbdb->tags AS tag ON (t.tag_id = tag.tag_id) 409 WHERE tt.tag_id = %d AND t.tag_id != %d GROUP BY t.tag_id ORDER BY tag_count DESC LIMIT %d", 410 $_tag->tag_id, $_tag->tag_id, $number 411 ); 412 413 foreach ( (array) $tags = $bbdb->get_results( $sql ) as $_tag ) { 414 wp_cache_add( $tag->tag, $tag, 'bb_tag' ); 415 wp_cache_add( $tag->tag_id, $tag->tag, 'bb_tag_id' ); 416 } 417 418 return $tags; 419 } 420
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)