Skip to:
Content

bbPress.org


Ignore:
Timestamp:
10/30/2011 04:41:28 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Remove clever code from bbp-topic-template.php. Tweak text in bbp_get_single_topic_description()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-topic-template.php

    r3505 r3558  
    185185
    186186                // Get all stickies
    187                 if ( $sticky_posts = get_posts( $sticky_query ) ) {
     187                $sticky_posts = get_posts( $sticky_query );
     188                if ( !empty( $sticky_posts ) ) {
    188189
    189190                    // Get a count of the visible stickies
     
    520521
    521522            // Set root text to page title
    522             if ( $page = bbp_get_page_by_path( $bbp->topic_archive_slug ) ) {
     523            $page = bbp_get_page_by_path( $bbp->topic_archive_slug );
     524            if ( !empty( $page ) ) {
    523525                $title = get_the_title( $page->ID );
    524526
     
    688690
    689691        // Add pagination to query object
    690         if ( $pagination_links = paginate_links( $pagination ) ) {
     692        $pagination_links = paginate_links( $pagination );
     693        if ( !empty( $pagination_links ) ) {
    691694
    692695            // Remove first page from pagination
    693             if ( $wp_rewrite->using_permalinks() )
     696            if ( $wp_rewrite->using_permalinks() ) {
    694697                $pagination_links = str_replace( $wp_rewrite->pagination_base . '/1/', '', $pagination_links );
    695             else
     698            } else {
    696699                $pagination_links = str_replace( '&paged=1', '', $pagination_links );
     700            }
    697701
    698702            // Add before and after to pagination links
     
    11621166        $author_avatar = '';
    11631167
    1164         if ( $topic_id = bbp_get_topic_id( $topic_id ) ) {
    1165 
    1166             // Check for anonymous user
    1167             if ( !bbp_is_topic_anonymous( $topic_id ) )
     1168        $topic_id = bbp_get_topic_id( $topic_id );
     1169        if ( !empty( $topic_id ) ) {
     1170            if ( !bbp_is_topic_anonymous( $topic_id ) ) {
    11681171                $author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size );
    1169             else
     1172            } else {
    11701173                $author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size );
     1174            }
    11711175        }
    11721176
     
    14791483
    14801484        // Try to get the most accurate freshness time possible
    1481         if ( !$last_active = get_post_meta( $topic_id, '_bbp_last_active_time', true ) ) {
    1482             if ( $reply_id = bbp_get_topic_last_reply_id( $topic_id ) ) {
     1485        $last_active = get_post_meta( $topic_id, '_bbp_last_active_time', true );
     1486        if ( empty( $last_active ) ) {
     1487            $reply_id = bbp_get_topic_last_reply_id( $topic_id );
     1488            if ( !empty( $reply_id ) ) {
    14831489                $last_active = get_post_field( 'post_date', $reply_id );
    14841490            } else {
     
    17121718
    17131719            // No link
    1714             if ( bbp_get_view_all() )
     1720            if ( bbp_get_view_all() ) {
    17151721                $retval .= " $extra";
    17161722
    17171723            // Link
    1718             else
     1724            } else {
    17191725                $retval .= " <a href='" . esc_url( bbp_add_view_all( bbp_get_topic_permalink( $topic_id ), true ) ) . "'>$extra</a>";
     1726            }
    17201727        }
    17211728
     
    27432750
    27442751        // Topic has replies
    2745         if ( $last_reply = bbp_get_topic_last_active_id( $topic_id ) ) {
     2752        $last_reply = bbp_get_topic_last_active_id( $topic_id );
     2753        if ( !empty( $last_reply ) ) {
    27462754            $last_updated_by = bbp_get_author_link( array( 'post_id' => $last_reply, 'size' => $size ) );
    2747             $retstr = sprintf( __( 'This topic has %1$s, contains %2$s, and was last updated by %3$s %4$s ago.', 'bbpress' ), $voice_count, $reply_count, $last_updated_by, $time_since );
     2755            $retstr = sprintf( __( 'This topic contains %1$s, has %2$s, and was last updated by %3$s %4$s ago.', 'bbpress' ), $reply_count, $voice_count, $last_updated_by, $time_since );
    27482756
    27492757        // Topic has no replies
    27502758        } else {
    2751             $retstr = sprintf( __( 'This topic has %1$s, contains %2$s.', 'bbpress' ), $voice_count, $reply_count );
     2759            $retstr = sprintf( __( 'This topic contains %1$s and has %2$s.', 'bbpress' ), $voice_count, $reply_count );
    27522760        }
    27532761
Note: See TracChangeset for help on using the changeset viewer.