Skip to:
Content

BuddyPress.org

Changeset 4149


Ignore:
Timestamp:
03/23/2011 09:14:24 PM (14 years ago)
Author:
boonebgorges
Message:

Modifies bp_forum_topic_tag_list() to use tag data from the topic_template global. Displays the topic tags underneath the topic title on the single topic page. Fixes #2281

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums/bp-forums-template.php

    r4147 r4149  
    822822            }
    823823        }
     824       
     825        // Load topic tags
     826        $this->topic_tags = bb_get_topic_tags( $this->topic_id );
    824827
    825828        if ( (int)$this->total_post_count && (int)$this->pag_num ) {
     
    914917            return false;
    915918    }
    916 
     919   
    917920    return apply_filters( 'bp_has_topic_posts', $topic_template->has_posts(), $topic_template );
    918921}
     
    11931196     */
    11941197    function bp_get_forum_topic_tag_list( $format = 'string' ) {
    1195         do_action( 'bbpress_init' );
     1198        global $topic_template;
    11961199       
    1197         // Pull up the tag objects
    1198         $tags_data = bb_get_topic_tags( bp_get_the_topic_id() );
     1200        $tags_data = !empty( $topic_template->topic_tags ) ? $topic_template->topic_tags : false;
    11991201       
    1200         // Convert them to a comma-separated string
    12011202        $tags = array();
    1202         foreach( $tags_data as $tag_data ) {
    1203             $tags[] = $tag_data->name;
     1203       
     1204        if ( $tags_data ) {
     1205            foreach( $tags_data as $tag_data ) {
     1206                $tags[] = $tag_data->name;
     1207            }
    12041208        }
    12051209       
     
    12101214    }
    12111215
     1216/**
     1217 * Returns true if the current topic has tags
     1218 *
     1219 * @package BuddyPress
     1220 * @since 1.3
     1221 *
     1222 * @return bool
     1223 */
     1224function bp_forum_topic_has_tags() {
     1225    global $topic_template;
     1226   
     1227    $has_tags = false;
     1228   
     1229    if ( !empty( $topic_template->topic_tags ) )
     1230        $has_tags = true;
     1231   
     1232    return apply_filters( 'bp_forum_topic_has_tags', $has_tags );
     1233}
     1234
    12121235function bp_forum_action() {
    12131236    echo bp_get_forum_action();
  • trunk/bp-themes/bp-default/_inc/css/default.css

    r4135 r4149  
    19041904}
    19051905
     1906div.topic-tags {
     1907    font-size: 11px;
     1908}
     1909
    19061910div.admin-links {
    19071911    position: absolute;
  • trunk/bp-themes/bp-default/groups/single/forum/topic.php

    r3928 r4149  
    2424        <div id="topic-meta">
    2525            <h3><?php bp_the_topic_title() ?> (<?php bp_the_topic_total_post_count() ?>)</h3>
     26           
     27            <?php if ( bp_forum_topic_has_tags() ) : ?>
     28               
     29                <div class="topic-tags">
     30               
     31                    <?php _e( 'Topic tags:', 'buddypress' ) ?> <?php bp_forum_topic_tag_list() ?>
     32               
     33                </div>
     34               
     35            <?php endif; ?>
    2636
    2737            <?php if ( bp_group_is_admin() || bp_group_is_mod() || bp_get_the_topic_is_mine() ) : ?>
Note: See TracChangeset for help on using the changeset viewer.