Changeset 2863 for trunk/bp-blogs.php
- Timestamp:
- 03/22/2010 11:34:23 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-blogs.php
r2842 r2863 1 1 <?php 2 3 define ( 'BP_BLOGS_DB_VERSION', '2015' );4 5 /* Define the slug for the component */6 if ( !defined( 'BP_BLOGS_SLUG' ) )7 define ( 'BP_BLOGS_SLUG', 'blogs' );8 9 2 require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-classes.php' ); 10 3 require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-templatetags.php' ); … … 14 7 require ( BP_PLUGIN_DIR . '/bp-blogs/bp-blogs-widgets.php' ); 15 8 16 function bp_blogs_install() {17 global $wpdb, $bp;18 19 if ( !empty($wpdb->charset) )20 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";21 22 $sql[] = "CREATE TABLE {$bp->blogs->table_name} (23 id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,24 user_id bigint(20) NOT NULL,25 blog_id bigint(20) NOT NULL,26 KEY user_id (user_id),27 KEY blog_id (blog_id)28 ) {$charset_collate};";29 30 $sql[] = "CREATE TABLE {$bp->blogs->table_name_blogmeta} (31 id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,32 blog_id bigint(20) NOT NULL,33 meta_key varchar(255) DEFAULT NULL,34 meta_value longtext DEFAULT NULL,35 KEY blog_id (blog_id),36 KEY meta_key (meta_key)37 ) {$charset_collate};";38 39 40 require_once(ABSPATH . 'wp-admin/upgrade-functions.php');41 42 dbDelta($sql);43 44 // On first installation - record all existing blogs in the system.45 if ( !(int)$bp->site_options['bp-blogs-first-install'] && bp_core_is_multisite() ) {46 bp_blogs_record_existing_blogs();47 add_site_option( 'bp-blogs-first-install', 1 );48 }49 50 update_site_option( 'bp-blogs-db-version', BP_BLOGS_DB_VERSION );51 }52 53 function bp_blogs_check_installed() {54 global $wpdb, $bp, $userdata;55 56 /* Only create the bp-blogs tables if this is a multisite install */57 if ( is_site_admin() && bp_core_is_multisite() ) {58 /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */59 if ( get_site_option( 'bp-blogs-db-version' ) < BP_BLOGS_DB_VERSION )60 bp_blogs_install();61 }62 }63 add_action( 'admin_menu', 'bp_blogs_check_installed' );64 65 9 function bp_blogs_setup_globals() { 66 10 global $bp, $wpdb; 67 11 12 if ( !defined( 'BP_BLOGS_SLUG' ) ) 13 define ( 'BP_BLOGS_SLUG', $bp->pages->blogs->slug ); 14 68 15 /* For internal identification */ 69 16 $bp->blogs->id = 'blogs'; 17 $bp->blogs->name = $bp->pages->blogs->name; 18 $bp->blogs->slug = BP_BLOGS_SLUG; 70 19 71 20 $bp->blogs->table_name = $wpdb->base_prefix . 'bp_user_blogs'; 72 21 $bp->blogs->table_name_blogmeta = $wpdb->base_prefix . 'bp_user_blogs_blogmeta'; 73 22 $bp->blogs->format_notification_function = 'bp_blogs_format_notifications'; 74 $bp->blogs->slug = BP_BLOGS_SLUG;75 23 76 24 /* Register this in the active components array */ … … 80 28 } 81 29 add_action( 'bp_setup_globals', 'bp_blogs_setup_globals' ); 82 83 function bp_blogs_setup_root_component() {84 /* Register 'blogs' as a root component */85 bp_core_add_root_component( BP_BLOGS_SLUG );86 }87 add_action( 'bp_setup_root_components', 'bp_blogs_setup_root_component' );88 30 89 31 /** … … 105 47 106 48 /* Add 'Blogs' to the main navigation */ 107 bp_core_new_nav_item( array( 'name' => sprintf( __( 'Blogs <span>(%d)</span>', 'buddypress' ), bp_blogs_total_blogs_for_user() ), 'slug' => $bp->blogs-> slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-blogs', 'item_css_id' => $bp->blogs->id ) );108 109 $blogs_link = $bp->loggedin_user->domain . $bp->blogs-> slug. '/';49 bp_core_new_nav_item( array( 'name' => sprintf( __( 'Blogs <span>(%d)</span>', 'buddypress' ), bp_blogs_total_blogs_for_user() ), 'slug' => $bp->blogs->name, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-blogs', 'item_css_id' => $bp->blogs->id ) ); 50 51 $blogs_link = $bp->loggedin_user->domain . $bp->blogs->name . '/'; 110 52 111 53 /* Set up the component options navigation for Blog */
Note: See TracChangeset
for help on using the changeset viewer.