Skip to:
Content

BuddyPress.org

Changeset 2753


Ignore:
Timestamp:
02/20/2010 12:32:00 PM (17 years ago)
Author:
apeatling
Message:

Fixed duplicate database hits when calling is_site_admin() in a loop on single WP installs. Fixed duplicate call to bp_activity_content_body() causing issues with filters.

Location:
branches/1.2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-activity/bp-activity-templatetags.php

    r2750 r2753  
    460460        }
    461461
     462        function bp_activity_has_content() {
     463                global $activities_template;
     464
     465                if ( !empty( $activities_template->activity->content ) )
     466                        return true;
     467
     468                return false;
     469        }
     470
    462471function bp_activity_content() {
    463472        echo bp_get_activity_content();
    … …  
    574583
    575584                                /* Delete link */
    576                                 if ( is_site_admin() || $bp->loggedin_user->id == $comment->user_id )
     585                                if ( $bp->loggedin_user->is_site_admin || $bp->loggedin_user->id == $comment->user_id )
    577586                                        $content .= ' &middot; <a href="' . wp_nonce_url( $bp->root_domain . '/' . $bp->activity->slug . '/delete/?cid=' . $comment->id, 'bp_activity_delete_link' ) . '" class="delete acomment-delete">' . __( 'Delete', 'buddypress' ) . '</a>';
    578587
  • branches/1.2/bp-core.php

    r2745 r2753  
    106106        /* The core userdata of the user who is currently logged in. */
    107107        $bp->loggedin_user->userdata = bp_core_get_core_userdata( $bp->loggedin_user->id );
     108
     109        /* is_site_admin() hits the DB on single WP installs, so we need to get this separately so we can call it in a loop. */
     110        $bp->loggedin_user->is_site_admin = is_site_admin();
    108111
    109112        /* The user id of the user currently being viewed, set in /bp-core/bp-core-catchuri.php */
  • branches/1.2/bp-themes/bp-default/activity/entry.php

    r2692 r2753  
    1616                </div>
    1717
    18                 <?php if ( bp_get_activity_content_body() ) : ?>
     18                <?php if ( bp_activity_has_content() ) : ?>
    1919                        <div class="activity-inner">
    2020                                <?php bp_activity_content_body() ?>
Note: See TracChangeset for help on using the changeset viewer.