Changeset 2863 for trunk/bp-friends.php
- Timestamp:
- 03/22/2010 11:34:23 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-friends.php
r2822 r2863 1 1 <?php 2 3 define ( 'BP_FRIENDS_DB_VERSION', '1800' );4 5 /* Define the slug for the component */6 if ( !defined( 'BP_FRIENDS_SLUG' ) )7 define ( 'BP_FRIENDS_SLUG', 'friends' );8 9 2 require ( BP_PLUGIN_DIR . '/bp-friends/bp-friends-classes.php' ); 10 3 require ( BP_PLUGIN_DIR . '/bp-friends/bp-friends-templatetags.php' ); 11 4 12 function friends_install() {13 global $wpdb, $bp;14 15 if ( !empty($wpdb->charset) )16 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";17 18 $sql[] = "CREATE TABLE {$bp->friends->table_name} (19 id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,20 initiator_user_id bigint(20) NOT NULL,21 friend_user_id bigint(20) NOT NULL,22 is_confirmed bool DEFAULT 0,23 is_limited bool DEFAULT 0,24 date_created datetime NOT NULL,25 KEY initiator_user_id (initiator_user_id),26 KEY friend_user_id (friend_user_id)27 ) {$charset_collate};";28 29 require_once(ABSPATH . 'wp-admin/upgrade-functions.php');30 dbDelta($sql);31 32 update_site_option( 'bp-friends-db-version', BP_FRIENDS_DB_VERSION );33 }34 35 5 function friends_setup_globals() { 36 6 global $bp, $wpdb; 7 8 if ( !defined( 'BP_FRIENDS_SLUG' ) ) 9 define( 'BP_FRIENDS_SLUG', 'friends' ); 37 10 38 11 /* For internal identification */ … … 49 22 } 50 23 add_action( 'bp_setup_globals', 'friends_setup_globals' ); 51 52 function friends_check_installed() {53 global $wpdb, $bp;54 55 if ( !is_site_admin() )56 return false;57 58 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */59 if ( get_site_option( 'bp-friends-db-version' ) < BP_FRIENDS_DB_VERSION )60 friends_install();61 }62 add_action( 'admin_menu', 'friends_check_installed' );63 24 64 25 function friends_setup_nav() {
Note: See TracChangeset
for help on using the changeset viewer.