Skip to:
Content

bbPress.org


Ignore:
Timestamp:
07/15/2015 04:30:34 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Moderators: Introduce none argument for topic-tags & forum-mods list functions.

This change allows for passing text or HTML to output if no taxonomy terms are found, and uses this new functionality in wp-admin to show per-forum moderators in the list-table column, also reducing code duplication.

See #459.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/topics/template.php

    r5827 r5835  
    23582358 * Output a the tags of a topic
    23592359 *
     2360 * @since bbPress (r2688)
     2361 *
    23602362 * @param int $topic_id Optional. Topic id
    23612363 * @param array $args See {@link bbp_get_topic_tag_list()}
     
    23672369    /**
    23682370     * Return the tags of a topic
     2371     *
     2372     * @since bbPress (r2688)
    23692373     *
    23702374     * @param int $topic_id Optional. Topic id
     
    23812385        // Bail if topic-tags are off
    23822386        if ( ! bbp_allow_topic_tags() ) {
    2383             return;
     2387            return '';
    23842388        }
    23852389
     
    23882392            'before' => '<div class="bbp-topic-tags"><p>' . esc_html__( 'Tagged:', 'bbpress' ) . '&nbsp;',
    23892393            'sep'    => ', ',
    2390             'after'  => '</p></div>'
     2394            'after'  => '</p></div>',
     2395            'none'   => ''
    23912396        ), 'get_topic_tag_list' );
    23922397
     
    23992404            $terms = get_post_meta( $topic_id, '_bbp_spam_topic_tags', true );
    24002405
    2401             // If terms exist, explode them and compile the return value
     2406            // If terms exist, implode them and compile the return value
    24022407            if ( ! empty( $terms ) ) {
    24032408                $terms  = implode( $r['sep'], $terms );
    24042409                $retval = $r['before'] . $terms . $r['after'];
    2405 
    2406             // No terms so return emty string
    2407             } else {
    2408                 $retval = '';
    24092410            }
    24102411
    24112412        // Topic is not spam so display a clickable term list
    24122413        } 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'];
    24142420        }
    24152421
Note: See TracChangeset for help on using the changeset viewer.