Skip to:
Content

BuddyPress.org

Changeset 2695 for trunk/bp-xprofile.php


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

Fixing the use of deprecated template tags in bp-default. Merged the fetching of BP runtime settings into one query to significantly reduce the number of run time database hits. Fixed #1916

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile.php

    r2678 r2695  
    1212require ( BP_PLUGIN_DIR . '/bp-xprofile/bp-xprofile-cssjs.php' );
    1313
    14 /* Assign the base group and fullname field names to constants to use in SQL statements */
    15 define ( 'BP_XPROFILE_BASE_GROUP_NAME', get_site_option( 'bp-xprofile-base-group-name' ) );
    16 define ( 'BP_XPROFILE_FULLNAME_FIELD_NAME', get_site_option( 'bp-xprofile-fullname-field-name' ) );
    17 
    1814/**
    1915 * xprofile_install()
     
    3228        $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
    3329
    34     if ( '' == get_site_option( 'bp-xprofile-base-group-name' ) )
     30    if ( empty( $bp->option['bp-xprofile-base-group-name'] ) )
    3531        update_site_option( 'bp-xprofile-base-group-name', 'Base' );
    3632
    37     if ( '' == get_site_option( 'bp-xprofile-fullname-field-name' ) )
     33    if ( empty( $bp->option['bp-xprofile-fullname-field-name'] ) )
    3834        update_site_option( 'bp-xprofile-fullname-field-name', 'Name' );
    3935
     
    7672    ) {$charset_collate};";
    7773
    78     if ( '' == get_site_option( 'bp-xprofile-db-version' ) ) {
     74    if ( empty( $bp->option['bp-xprofile-db-version'] ) ) {
    7975        if ( !$wpdb->get_var( "SELECT id FROM {$bp->profile->table_name_groups} WHERE id = 1" ) )
    80             $sql[] = "INSERT INTO {$bp->profile->table_name_groups} VALUES ( 1, '" . get_site_option( 'bp-xprofile-base-group-name' ) . "', '', 0 );";
     76            $sql[] = "INSERT INTO {$bp->profile->table_name_groups} VALUES ( 1, '" . $bp->option['bp-xprofile-base-group-name'] . "', '', 0 );";
    8177
    8278        if ( !$wpdb->get_var( "SELECT id FROM {$bp->profile->table_name_fields} WHERE id = 1" ) ) {
     
    8480                        id, group_id, parent_id, type, name, is_required, can_delete
    8581                      ) VALUES (
    86                         1, 1, 0, 'textbox', '" . get_site_option( 'bp-xprofile-fullname-field-name' ) . "', 1, 0
     82                        1, 1, 0, 'textbox', '" . $bp->option['bp-xprofile-fullname-field-name'] . "', 1, 0
    8783                      );";
    8884        }
     
    110106    global $bp, $wpdb;
    111107
     108    /* Assign the base group and fullname field names to constants to use in SQL statements */
     109    define ( 'BP_XPROFILE_BASE_GROUP_NAME', $bp->site_options['bp-xprofile-base-group-name'] );
     110    define ( 'BP_XPROFILE_FULLNAME_FIELD_NAME', $bp->site_options['bp-xprofile-fullname-field-name'] );
     111
    112112    /* For internal identification */
    113113    $bp->profile->id = 'profile';
     
    129129}
    130130add_action( 'bp_setup_globals', 'xprofile_setup_globals' );
    131 add_action( 'admin_menu', 'xprofile_setup_globals', 2 );
    132131
    133132/**
     
    157156
    158157    /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    159     if ( get_site_option('bp-xprofile-db-version') < BP_XPROFILE_DB_VERSION )
     158    if ( $bp->option['bp-xprofile-db-version'] < BP_XPROFILE_DB_VERSION )
    160159        xprofile_install();
    161160}
     
    868867    global $bp, $wpdb;
    869868
    870     if ( (int)get_site_option( 'bp-disable-profile-sync' ) )
     869    if ( (int)$bp->option['bp-disable-profile-sync'] )
    871870        return true;
    872871
Note: See TracChangeset for help on using the changeset viewer.