Changeset 2695 for trunk/bp-core.php
- Timestamp:
- 02/12/2010 12:31:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core.php
r2678 r2695 23 23 define( 'BP_ROOT_BLOG', 1 ); 24 24 25 /* Define the user and usermeta table names, useful if you are using custom or shared tables */25 /* Define the user and usermeta table names, useful if you are using custom or shared tables. */ 26 26 if ( !defined( 'CUSTOM_USER_TABLE' ) ) 27 27 define( 'CUSTOM_USER_TABLE', $wpdb->base_prefix . 'users' ); … … 40 40 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-notifications.php' ); 41 41 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-signup.php' ); 42 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-activation.php' ); 43 44 /* If BP_DISABLE_ADMIN_BAR is defined, do not load the global admin bar */ 42 43 /* Multisite includes built in account activation support. */ 44 if ( bp_core_is_multisite() ) 45 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-activation.php' ); 46 47 /* If BP_DISABLE_ADMIN_BAR is defined, do not load the global admin bar. */ 45 48 if ( !defined( 'BP_DISABLE_ADMIN_BAR' ) ) 46 49 require ( BP_PLUGIN_DIR . '/bp-core/bp-core-adminbar.php' ); … … 61 64 if ( !defined( 'BP_SEARCH_SLUG' ) ) 62 65 define( 'BP_SEARCH_SLUG', 'search' ); 63 64 /* Define the slug for the search page */65 if ( !defined( 'BP_HOME_BLOG_SLUG' ) )66 define( 'BP_HOME_BLOG_SLUG', 'blog' );67 66 68 67 /* Register BuddyPress themes contained within the bp-theme folder */ … … 142 141 } 143 142 143 /* Fetches all of the core database based BuddyPress settings in one foul swoop */ 144 $bp->site_options = bp_core_get_site_options(); 145 144 146 /* Sets up the array container for the component navigation rendered by bp_get_nav() */ 145 147 $bp->bp_nav = array(); … … 148 150 $bp->bp_options_nav = array(); 149 151 150 /* Sets up container used for the title of the current component option and rendered by bp_get_options_title() */151 $bp->bp_options_title = '';152 153 /* Sets up container used for the avatar of the current component being viewed. Rendered by bp_get_options_avatar() */154 $bp->bp_options_avatar = '';155 156 152 /* Contains an array of all the active components. The key is the slug, value the internal ID of the component */ 157 153 $bp->active_components = array(); 158 154 159 155 /* Fetches the default Gravatar image to use if the user/group/blog has no avatar or gravatar */ 160 $bp->grav_default->user = apply_filters( 'bp_user_gravatar_default', get_site_option( 'user-avatar-default' ));156 $bp->grav_default->user = apply_filters( 'bp_user_gravatar_default', $bp->site_options['user-avatar-default'] ); 161 157 $bp->grav_default->group = apply_filters( 'bp_group_gravatar_default', 'identicon' ); 162 158 $bp->grav_default->blog = apply_filters( 'bp_blog_gravatar_default', 'identicon' ); … … 183 179 } 184 180 add_action( 'bp_setup_globals', 'bp_core_setup_globals' ); 185 add_action( '_admin_menu', 'bp_core_setup_globals', 2 ); // must be _admin_menu hook.186 187 181 188 182 /** … … 202 196 bp_core_add_root_component( BP_ACTIVATION_SLUG ); 203 197 bp_core_add_root_component( BP_SEARCH_SLUG ); 204 bp_core_add_root_component( BP_HOME_BLOG_SLUG );205 198 } 206 199 add_action( 'plugins_loaded', 'bp_core_setup_root_uris', 2 ); … … 274 267 275 268 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */ 276 if ( get_site_option('bp-core-db-version')< BP_CORE_DB_VERSION )269 if ( $bp->site_options['bp-core-db-version'] < BP_CORE_DB_VERSION ) 277 270 bp_core_install(); 278 271 } … … 558 551 return apply_filters( 'bp_core_get_user_domain', $domain ); 559 552 } 560 /* DEPRECATED */561 function bp_core_get_userurl( $uid ) { return bp_core_get_user_domain( $uid ); }562 553 563 554 /** … … 1077 1068 * @return str The link text based on passed parameters. 1078 1069 */ 1079 function bp_core_get_userlink( $user_id, $no_anchor = false, $just_link = false , $deprecated = false, $with_s = false) {1070 function bp_core_get_userlink( $user_id, $no_anchor = false, $just_link = false ) { 1080 1071 $display_name = bp_core_get_user_displayname( $user_id ); 1081 1072 … … 1083 1074 return false; 1084 1075 1085 if ( $with_s )1086 $display_name = sprintf( __( "%s's", 'buddypress' ), $display_name );1087 1088 1076 if ( $no_anchor ) 1089 1077 return $display_name; … … 1095 1083 return $url; 1096 1084 1097 return apply_filters( 'bp_core_get_userlink', '<a href="' . $url . '" >' . $display_name . '</a>', $user_id );1085 return apply_filters( 'bp_core_get_userlink', '<a href="' . $url . '" title="' . $display_name . '">' . $display_name . '</a>', $user_id ); 1098 1086 } 1099 1087 … … 1533 1521 1534 1522 return apply_filters( 'bp_core_get_site_path', $site_path ); 1523 } 1524 1525 /** 1526 * bp_core_get_site_options() 1527 * 1528 * BuddyPress uses site options to store configuration settings. Many of these settings are needed 1529 * at run time. Instead of fetching them all and adding many initial queries to each page load, let's fetch 1530 * them all in one go. 1531 * 1532 * @package BuddyPress Core 1533 */ 1534 function bp_core_get_site_options() { 1535 global $bp, $wpdb; 1536 1537 $options = apply_filters( 'bp_core_site_options', array( 1538 'bp-core-db-version', 1539 'bp-activity-db-version', 1540 'bp-blogs-db-version', 1541 'bp-friends-db-version', 1542 'bp-groups-db-version', 1543 'bp-messages-db-version', 1544 'bp-xprofile-db-version', 1545 'bp-deactivated-components', 1546 'bp-blogs-first-install', 1547 'bp-disable-blog-forum-comments', 1548 'bp-xprofile-base-group-name', 1549 'bp-xprofile-fullname-field-name', 1550 'bp-hide-loggedout-adminbar', 1551 'bp-disable-profile-sync', 1552 'bp-disable-avatar-uploads', 1553 'bp-disable-account-deletion', 1554 'bp-disable-forum-directory', 1555 'bp-disable-blogforum-comments', 1556 'bb-config-location', 1557 1558 /* Useful WordPress settings used often */ 1559 'user-avatar-default', 1560 'tags_blog_id', 1561 'registration', 1562 'fileupload_maxk' 1563 ) ); 1564 1565 $meta_keys = "'" . implode( "','", (array)$options ) ."'"; 1566 1567 if ( bp_core_is_multisite() ) 1568 $meta = $wpdb->get_results( "SELECT meta_key AS name, meta_value AS value FROM {$wpdb->sitemeta} WHERE meta_key IN ({$meta_keys})" ); 1569 else 1570 $meta = $wpdb->get_results( "SELECT option_name AS name, option_value AS value FROM {$wpdb->options} WHERE option_name IN ({$meta_keys})" ); 1571 1572 $site_options = array(); 1573 if ( !empty( $meta ) ) { 1574 foreach( (array)$meta as $meta_item ) 1575 $site_options[$meta_item->name] = $meta_item->value; 1576 } 1577 1578 return apply_filters( 'bp_core_get_site_options', $site_options ); 1535 1579 } 1536 1580
Note: See TracChangeset
for help on using the changeset viewer.