Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/13/2010 04:01:07 PM (14 years ago)
Author:
apeatling
Message:

Replacing function_exists() checks with bp_is_active() checks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-classes.php

    r2695 r2919  
    5656     */
    5757    function populate() {
    58         if ( function_exists( 'xprofile_install' ) )
     58        if ( bp_is_active( 'xprofile' ) )
    5959            $this->profile_data = $this->get_profile_data();
    6060
     
    8686        global $bp;
    8787
    88         if ( function_exists('friends_install') )
     88        if ( bp_is_active( 'friends' ) )
    8989            $this->total_friends = BP_Friends_Friendship::total_friend_count( $this->id );
    9090
    91         if ( function_exists('groups_install') ) {
     91        if ( bp_is_active( 'groups' ) ) {
    9292            $this->total_groups = BP_Groups_Member::total_group_count( $this->id );
    9393
     
    125125        $sql['from'] = "FROM " . CUSTOM_USER_TABLE . " u LEFT JOIN " . CUSTOM_USER_META_TABLE . " um ON um.user_id = u.ID";
    126126
    127         if ( $search_terms && function_exists( 'xprofile_install' ) || 'alphabetical' == $type )
     127        if ( $search_terms && bp_is_active( 'xprofile' ) || 'alphabetical' == $type )
    128128            $sql['join_profiledata'] = "LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id";
    129129
     
    142142            $sql['where_alpha'] = "AND pd.field_id = 1";
    143143
    144         if ( $user_id && function_exists( 'friends_install' ) ) {
     144        if ( $user_id && bp_is_active( 'friends' ) ) {
    145145            $friend_ids = friends_get_friend_user_ids( $user_id );
    146146            $friend_ids = $wpdb->escape( implode( ',', (array)$friend_ids ) );
     
    154154        }
    155155
    156         if ( $search_terms && function_exists( 'xprofile_install' ) ) {
     156        if ( $search_terms && bp_is_active( 'xprofile' ) ) {
    157157            $search_terms = like_escape( $wpdb->escape( $search_terms ) );
    158158            $sql['where_searchterms'] = "AND pd.value LIKE '%%$search_terms%%'";
     
    320320
    321321        /* Fetch the user's full name */
    322         if ( function_exists( 'xprofile_install' ) && 'alphabetical' != $type ) {
     322        if ( bp_is_active( 'xprofile' ) && 'alphabetical' != $type ) {
    323323            $names = $wpdb->get_results( $wpdb->prepare( "SELECT pd.user_id as id, pd.value as fullname FROM {$bp->profile->table_name_fields} pf, {$bp->profile->table_name_data} pd WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} )", BP_XPROFILE_FULLNAME_FIELD_NAME ) );
    324324            for ( $i = 0; $i < count( $paged_users ); $i++ ) {
     
    342342
    343343        /* Fetch whether or not the user is a friend */
    344         if ( function_exists( 'friends_install' ) ) {
     344        if ( bp_is_active( 'friends' ) ) {
    345345            $friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )", $bp->loggedin_user->id, $bp->loggedin_user->id ) );
    346346            for ( $i = 0; $i < count( $paged_users ); $i++ ) {
     
    381381            }
    382382        }
     383
     384        var_dump( $paged_users );
    383385
    384386        return $paged_users;
Note: See TracChangeset for help on using the changeset viewer.