Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/02/2010 12:40:49 PM (16 years ago)
Author:
apeatling
Message:

Removing database hits inside BP loops to improve overall performance.

File:
1 edited

Legend:

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

    r2488 r2533  
    9393        }
    9494
     95        /* Fetch extra information for topics, so we don't have to query inside the loop */
     96        $this->topics = bp_forums_get_topic_extras( &$this->topics );
     97
    9598        $this->pag_links = paginate_links( array(
    9699            'base' => add_query_arg( array( 'p' => '%#%', 'n' => $this->pag_num ) ),
     
    348351        global $forum_template;
    349352
    350         if ( !$name = bp_core_get_userlink( $forum_template->topic->topic_last_poster ) )
     353        if ( !$domain = bp_core_get_user_domain( $forum_template->topic->topic_last_poster, $forum_template->topic->topic_last_poster_nicename, $forum_template->topic->topic_last_poster_login ) )
    351354            return __( 'Deleted User', 'buddypress' );
    352355
    353         return apply_filters( 'bp_get_the_topic_last_poster_name', $name );
     356        return apply_filters( 'bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>' );
    354357    }
    355358
     
    387390        extract( $r, EXTR_SKIP );
    388391
    389         return apply_filters( 'bp_get_the_topic_last_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->topic_last_poster, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
     392        return apply_filters( 'bp_get_the_topic_last_poster_avatar', bp_core_fetch_avatar( array( 'email' => $forum_template->topic->topic_last_poster_email, 'item_id' => $forum_template->topic->topic_last_poster, 'type' => $type, 'width' => $width, 'height' => $height ) ) );
    390393    }
    391394
Note: See TracChangeset for help on using the changeset viewer.