Skip to:
Content

BuddyPress.org

Changeset 1227


Ignore:
Timestamp:
03/17/2009 10:43:24 AM (18 years ago)
Author:
apeatling
Message:

Removed LIKE table checks and used the DB version checks for upgrades instead.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity.php

    r1225 r1227  
    160160        if ( $bp->displayed_user->id ) {
    161161                /* Check to see if the current user has their activity table set up. If not, set them up. */
    162                 if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp->activity->table_name_current_user . "%'") || get_usermeta( $bp->displayed_user->id, 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION  )
     162                if ( get_usermeta( $bp->displayed_user->id, 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION  )
    163163                        bp_activity_user_install();
    164164        }
    … …  
    166166        if ( is_site_admin() && 1 == $current_blog->blog_id ) {
    167167                /* Check to see if the site wide activity table is set up. */
    168                 if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp->activity->table_name_sitewide . "%'") || get_site_option( 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION  )
     168                if ( get_site_option( 'bp-activity-db-version' ) < BP_ACTIVITY_VERSION  )
    169169                        bp_activity_sitewide_install();
    170170        }
  • trunk/bp-blogs.php

    r1225 r1227  
    120120        if ( is_site_admin() ) {
    121121                /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    122                 if ( ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp->blogs->table_name . "%'") ) || ( get_site_option('bp-blogs-db-version') < BP_BLOGS_DB_VERSION ) )
     122                if ( get_site_option('bp-blogs-db-version') < BP_BLOGS_DB_VERSION )
    123123                        bp_blogs_install();
    124124        }
  • trunk/bp-core.php

    r1225 r1227  
    225225        if ( is_site_admin() ) {
    226226                /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    227                 if ( ( !$wpdb->get_var( "SHOW TABLES LIKE '%{$bp->core->table_name_notifications}%'" ) ) || ( get_site_option('bp-core-db-version') < BP_CORE_DB_VERSION ) )
     227                if ( get_site_option('bp-core-db-version') < BP_CORE_DB_VERSION )
    228228                        bp_core_install();
    229229        }
    … …  
    401401
    402402/**
     403 * bp_core_remove_nav_item()
     404 *
     405 * Removes a navigation item from the navigation array used in BuddyPress themes.
     406 *
     407 * @package BuddyPress Core
     408 * @param $parent_id The id of the parent navigation item.
     409 * @param $slug The slug of the sub navigation item.
     410 */
     411function bp_core_remove_nav_item( $name ) {
     412        global $bp;
     413
     414        foreach( (array) $bp->bp_nav as $item_key => $item_value ) {
     415                if ( $item_value['name'] == $name ) {
     416                        unset( $bp->bp_nav[$item_key] );
     417                }
     418        }
     419       
     420        foreach( (array) $bp->bp_users_nav as $item_key => $item_value ) {
     421                if ( $item_value['name'] == $name ) {
     422                        unset( $bp->bp_nav[$item_key] );
     423                }
     424        }
     425}
     426
     427/**
    403428 * bp_core_add_subnav_item()
    404429 *
    … …  
    407432 * @package BuddyPress Core
    408433 * @param $parent_id The id of the parent navigation item.
    409  * @param $id A unique id for the sub navigation item.
     434 * @param $slug The slug of the sub navigation item.
    410435 * @param $name The display name for the sub navigation item, e.g. 'Public' or 'Change Avatar'
    411436 * @param $link The url for the sub navigation item.
    … …  
    435460}
    436461
     462/**
     463 * bp_core_remove_subnav_item()
     464 *
     465 * Removes a navigation item from the sub navigation array used in BuddyPress themes.
     466 *
     467 * @package BuddyPress Core
     468 * @param $parent_id The id of the parent navigation item.
     469 * @param $slug The slug of the sub navigation item.
     470 */
     471function bp_core_remove_subnav_item( $parent_id, $slug ) {
     472        global $bp;
     473       
     474        unset( $bp->bp_options_nav[$parent_id][$slug] );
     475}
    437476
    438477/**
  • trunk/bp-friends.php

    r1225 r1227  
    8282        if ( is_site_admin() ) {
    8383                /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    84                 if ( ( !$wpdb->get_var( "SHOW TABLES LIKE '%{$bp->friends->table_name}%'") ) || ( get_site_option('bp-friends-db-version') < BP_FRIENDS_DB_VERSION ) )
     84                if ( get_site_option('bp-friends-db-version') < BP_FRIENDS_DB_VERSION )
    8585                        friends_install();
    8686        }
  • trunk/bp-groups.php

    r1225 r1227  
    161161        if ( is_site_admin() ) {
    162162                /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    163                 if ( !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp->groups->table_name . "%'") || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION ) )
     163                if ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION )
    164164                        groups_install();
    165165                       
    166                 if ( ( function_exists('bp_wire_install') && !$wpdb->get_var("SHOW TABLES LIKE '%" . $bp->groups->table_name_wire . "%'") ) || ( get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION ) )
     166                if ( function_exists('bp_wire_install') && get_site_option('bp-groups-db-version') < BP_GROUPS_DB_VERSION )
    167167                        groups_wire_install();
    168168        }
    … …  
    17071707}
    17081708
    1709 
    17101709function groups_get_invites_for_group( $user_id, $group_id ) {
    17111710        return BP_Groups_Group::get_invites( $user_id, $group_id );
  • trunk/bp-messages.php

    r1225 r1227  
    133133        if ( is_site_admin() ) {
    134134                /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    135                 if ( !$wpdb->get_var( "SHOW TABLES LIKE '%{$bp->messages->table_name_messages}%'" ) || ( get_site_option('bp-messages-db-version') < BP_MESSAGES_DB_VERSION ) )
     135                if ( get_site_option('bp-messages-db-version') < BP_MESSAGES_DB_VERSION )
    136136                        messages_install();
    137137        }
  • trunk/bp-xprofile.php

    r1225 r1227  
    198198
    199199        /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    200         if ( !$wpdb->get_var("SHOW TABLES LIKE '%{$bp->profile->table_name_groups}%'") || ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION ) )
     200        if ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION )
    201201                xprofile_install();
    202202       
    203         if ( ( function_exists('bp_wire_install') && !$wpdb->get_var( "SHOW TABLES LIKE '%{$bp->profile->table_name_wire}%'" ) ) || ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION ) )
     203        if ( function_exists('bp_wire_install') && get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION )
    204204                xprofile_wire_install();
    205205}
Note: See TracChangeset for help on using the changeset viewer.