<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][8563] trunk/src/bp-core/admin/bp-core-schema.php: Add phpdoc blocks and brackets to installation functions in `bp-core-schema.php`</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/8563">8563</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2014-07-09 12:53:00 +0000 (Wed, 09 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add phpdoc blocks and brackets to installation functions in `bp-core-schema.php`</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpcoreadminbpcoreschemaphp">trunk/src/bp-core/admin/bp-core-schema.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpcoreadminbpcoreschemaphp"></a>
<div class="modfile"><h4>Modified: trunk/src/bp-core/admin/bp-core-schema.php (8562 => 8563)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/bp-core/admin/bp-core-schema.php       2014-07-09 01:13:32 UTC (rev 8562)
+++ trunk/src/bp-core/admin/bp-core-schema.php  2014-07-09 12:53:00 UTC (rev 8563)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> <?php
</span><ins>+
</ins><span class="cx"> /**
</span><span class="cx">  * BuddyPress DB schema
</span><span class="cx">  *
</span><span class="lines">@@ -9,82 +10,121 @@
</span><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx"> 
</span><ins>+/**
+ * Get the DB schema to use for BuddyPress components
+ *
+ * @since BuddyPress (1.1.0)
+ *
+ * @global $wpdb $wpdb
+ * @return string The default database character-set, if set
+ */
</ins><span class="cx"> function bp_core_set_charset() {
</span><span class="cx">  global $wpdb;
</span><span class="cx"> 
</span><span class="cx">  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
</span><span class="cx"> 
</span><del>-       // BuddyPress component DB schema
</del><span class="cx">   return !empty( $wpdb->charset ) ? "DEFAULT CHARACTER SET {$wpdb->charset}" : '';
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Main installer
+ *
+ * Can be passed an optional array of components to explicitly run installation
+ * routines on, typically the first time a component is activated in Settings.
+ *
+ * @since BuddyPress (1.0.0)
+ *
+ * @param array $active_components Components to install
+ */
</ins><span class="cx"> function bp_core_install( $active_components = false ) {
</span><span class="cx"> 
</span><del>-       if ( empty( $active_components ) )
</del><ins>+        // If no components passed, get all the active components from the main site
+       if ( empty( $active_components ) ) {
</ins><span class="cx">           $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );
</span><ins>+       }
</ins><span class="cx"> 
</span><del>-       // Activity Streams
-       // Install tables even when inactive, to store last_activity data
</del><ins>+        // Install Activity Streams even when inactive (to store last_activity data)
</ins><span class="cx">   bp_core_install_activity_streams();
</span><span class="cx"> 
</span><ins>+       // Install the signups table
+       bp_core_maybe_install_signups();
+
</ins><span class="cx">   // Notifications
</span><del>-       if ( !empty( $active_components['notifications'] ) )
</del><ins>+        if ( !empty( $active_components['notifications'] ) ) {
</ins><span class="cx">           bp_core_install_notifications();
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  // Friend Connections
</span><del>-       if ( !empty( $active_components['friends'] ) )
</del><ins>+        if ( !empty( $active_components['friends'] ) ) {
</ins><span class="cx">           bp_core_install_friends();
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  // Extensible Groups
</span><del>-       if ( !empty( $active_components['groups'] ) )
</del><ins>+        if ( !empty( $active_components['groups'] ) ) {
</ins><span class="cx">           bp_core_install_groups();
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  // Private Messaging
</span><del>-       if ( !empty( $active_components['messages'] ) )
</del><ins>+        if ( !empty( $active_components['messages'] ) ) {
</ins><span class="cx">           bp_core_install_private_messaging();
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  // Extended Profiles
</span><del>-       if ( !empty( $active_components['xprofile'] ) )
</del><ins>+        if ( !empty( $active_components['xprofile'] ) ) {
</ins><span class="cx">           bp_core_install_extended_profiles();
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  // Blog tracking
</span><del>-       if ( !empty( $active_components['blogs'] ) )
</del><ins>+        if ( !empty( $active_components['blogs'] ) ) {
</ins><span class="cx">           bp_core_install_blog_tracking();
</span><del>-
-       // Install the signups table
-       bp_core_maybe_install_signups();
-
</del><ins>+        }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Install database tables for the Notifications component
+ *
+ * @since BuddyPress (1.0.0)
+ * 
+ * @uses bp_core_set_charset()
+ * @uses bp_core_get_table_prefix()
+ * @uses dbDelta()
+ */
</ins><span class="cx"> function bp_core_install_notifications() {
</span><del>-
</del><span class="cx">   $sql             = array();
</span><span class="cx">  $charset_collate = bp_core_set_charset();
</span><span class="cx">  $bp_prefix       = bp_core_get_table_prefix();
</span><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_notifications (
</span><del>-                           id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                           user_id bigint(20) NOT NULL,
-                           item_id bigint(20) NOT NULL,
-                           secondary_item_id bigint(20),
-                           component_name varchar(75) NOT NULL,
-                           component_action varchar(75) NOT NULL,
-                           date_notified datetime NOT NULL,
-                           is_new bool NOT NULL DEFAULT 0,
-                       KEY item_id (item_id),
-                           KEY secondary_item_id (secondary_item_id),
-                           KEY user_id (user_id),
-                           KEY is_new (is_new),
-                           KEY component_name (component_name),
-                           KEY component_action (component_action),
-                           KEY useritem (user_id,is_new)
-                      ) {$charset_collate};";
</del><ins>+                                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                               user_id bigint(20) NOT NULL,
+                               item_id bigint(20) NOT NULL,
+                               secondary_item_id bigint(20),
+                               component_name varchar(75) NOT NULL,
+                               component_action varchar(75) NOT NULL,
+                               date_notified datetime NOT NULL,
+                               is_new bool NOT NULL DEFAULT 0,
+                               KEY item_id (item_id),
+                               KEY secondary_item_id (secondary_item_id),
+                               KEY user_id (user_id),
+                               KEY is_new (is_new),
+                               KEY component_name (component_name),
+                               KEY component_action (component_action),
+                               KEY useritem (user_id,is_new)
+                       ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  dbDelta( $sql );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Install database tables for the Activity component
+ *
+ * @since BuddyPress (1.0.0)
+ * 
+ * @uses bp_core_set_charset()
+ * @uses bp_core_get_table_prefix()
+ * @uses dbDelta()
+ */
</ins><span class="cx"> function bp_core_install_activity_streams() {
</span><del>-
</del><span class="cx">   $sql             = array();
</span><span class="cx">  $charset_collate = bp_core_set_charset();
</span><span class="cx">  $bp_prefix       = bp_core_get_table_prefix();
</span><span class="lines">@@ -123,52 +163,68 @@
</span><span class="cx">                          meta_value longtext DEFAULT NULL,
</span><span class="cx">                          KEY activity_id (activity_id),
</span><span class="cx">                          KEY meta_key (meta_key)
</span><del>-                          ) {$charset_collate};";
</del><ins>+                        ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  dbDelta( $sql );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Install database tables for the Notifications component
+ *
+ * @since BuddyPress (1.0.0)
+ * 
+ * @uses bp_core_set_charset()
+ * @uses bp_core_get_table_prefix()
+ * @uses dbDelta()
+ */
</ins><span class="cx"> function bp_core_install_friends() {
</span><del>-
</del><span class="cx">   $sql             = array();
</span><span class="cx">  $charset_collate = bp_core_set_charset();
</span><span class="cx">  $bp_prefix       = bp_core_get_table_prefix();
</span><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_friends (
</span><del>-                           id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                           initiator_user_id bigint(20) NOT NULL,
-                           friend_user_id bigint(20) NOT NULL,
-                           is_confirmed bool DEFAULT 0,
-                           is_limited bool DEFAULT 0,
-                           date_created datetime NOT NULL,
-                       KEY initiator_user_id (initiator_user_id),
-                       KEY friend_user_id (friend_user_id)
-                      ) {$charset_collate};";
</del><ins>+                                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                               initiator_user_id bigint(20) NOT NULL,
+                               friend_user_id bigint(20) NOT NULL,
+                               is_confirmed bool DEFAULT 0,
+                               is_limited bool DEFAULT 0,
+                               date_created datetime NOT NULL,
+                               KEY initiator_user_id (initiator_user_id),
+                               KEY friend_user_id (friend_user_id)
+                       ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  dbDelta( $sql );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Install database tables for the Groups component
+ *
+ * @since BuddyPress (1.0.0)
+ * 
+ * @uses bp_core_set_charset()
+ * @uses bp_core_get_table_prefix()
+ * @uses dbDelta()
+ */
</ins><span class="cx"> function bp_core_install_groups() {
</span><del>-
</del><span class="cx">   $sql             = array();
</span><span class="cx">  $charset_collate = bp_core_set_charset();
</span><span class="cx">  $bp_prefix       = bp_core_get_table_prefix();
</span><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_groups (
</span><del>-                               id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
</del><ins>+                                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
</ins><span class="cx">                           creator_id bigint(20) NOT NULL,
</span><del>-                               name varchar(100) NOT NULL,
-                               slug varchar(200) NOT NULL,
-                               description longtext NOT NULL,
</del><ins>+                                name varchar(100) NOT NULL,
+                               slug varchar(200) NOT NULL,
+                               description longtext NOT NULL,
</ins><span class="cx">                           status varchar(10) NOT NULL DEFAULT 'public',
</span><span class="cx">                          enable_forum tinyint(1) NOT NULL DEFAULT '1',
</span><span class="cx">                          date_created datetime NOT NULL,
</span><del>-                           KEY creator_id (creator_id),
-                           KEY status (status)
-                          ) {$charset_collate};";
</del><ins>+                                KEY creator_id (creator_id),
+                               KEY status (status)
+                       ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_groups_members (
</span><del>-                               id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
</del><ins>+                                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
</ins><span class="cx">                           group_id bigint(20) NOT NULL,
</span><span class="cx">                          user_id bigint(20) NOT NULL,
</span><span class="cx">                          inviter_id bigint(20) NOT NULL,
</span><span class="lines">@@ -183,10 +239,10 @@
</span><span class="cx">                          KEY group_id (group_id),
</span><span class="cx">                          KEY is_admin (is_admin),
</span><span class="cx">                          KEY is_mod (is_mod),
</span><del>-                               KEY user_id (user_id),
</del><ins>+                                KEY user_id (user_id),
</ins><span class="cx">                           KEY inviter_id (inviter_id),
</span><span class="cx">                          KEY is_confirmed (is_confirmed)
</span><del>-                          ) {$charset_collate};";
</del><ins>+                        ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_groups_groupmeta (
</span><span class="cx">                          id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
</span><span class="lines">@@ -195,54 +251,71 @@
</span><span class="cx">                          meta_value longtext DEFAULT NULL,
</span><span class="cx">                          KEY group_id (group_id),
</span><span class="cx">                          KEY meta_key (meta_key)
</span><del>-                          ) {$charset_collate};";
</del><ins>+                        ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  dbDelta( $sql );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function bp_core_install_private_messaging() {
-
</del><ins>+/**
+ * Install database tables for the Messsages component
+ *
+ * @since BuddyPress (1.0.0)
+ * 
+ * @uses bp_core_set_charset()
+ * @uses bp_core_get_table_prefix()
+ * @uses dbDelta()
+ */
+function bp_core_install_messages() {
</ins><span class="cx">   $sql             = array();
</span><span class="cx">  $charset_collate = bp_core_set_charset();
</span><span class="cx">  $bp_prefix       = bp_core_get_table_prefix();
</span><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_messages (
</span><del>-                               id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                               thread_id bigint(20) NOT NULL,
-                               sender_id bigint(20) NOT NULL,
-                               subject varchar(200) NOT NULL,
-                               message longtext NOT NULL,
-                               date_sent datetime NOT NULL,
-                           KEY sender_id (sender_id),
-                           KEY thread_id (thread_id)
-                          ) {$charset_collate};";
</del><ins>+                                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                               thread_id bigint(20) NOT NULL,
+                               sender_id bigint(20) NOT NULL,
+                               subject varchar(200) NOT NULL,
+                               message longtext NOT NULL,
+                               date_sent datetime NOT NULL,
+                               KEY sender_id (sender_id),
+                               KEY thread_id (thread_id)
+                       ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_recipients (
</span><del>-                               id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                               user_id bigint(20) NOT NULL,
-                               thread_id bigint(20) NOT NULL,
-                               unread_count int(10) NOT NULL DEFAULT '0',
</del><ins>+                                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                               user_id bigint(20) NOT NULL,
+                               thread_id bigint(20) NOT NULL,
+                               unread_count int(10) NOT NULL DEFAULT '0',
</ins><span class="cx">                           sender_only tinyint(1) NOT NULL DEFAULT '0',
</span><span class="cx">                          is_deleted tinyint(1) NOT NULL DEFAULT '0',
</span><del>-                           KEY user_id (user_id),
-                           KEY thread_id (thread_id),
</del><ins>+                                KEY user_id (user_id),
+                               KEY thread_id (thread_id),
</ins><span class="cx">                           KEY is_deleted (is_deleted),
</span><span class="cx">                          KEY sender_only (sender_only),
</span><del>-                           KEY unread_count (unread_count)
-                          ) {$charset_collate};";
</del><ins>+                                KEY unread_count (unread_count)
+                       ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_notices (
</span><del>-                               id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                               subject varchar(200) NOT NULL,
-                               message longtext NOT NULL,
-                               date_sent datetime NOT NULL,
</del><ins>+                                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                               subject varchar(200) NOT NULL,
+                               message longtext NOT NULL,
+                               date_sent datetime NOT NULL,
</ins><span class="cx">                           is_active tinyint(1) NOT NULL DEFAULT '0',
</span><del>-                           KEY is_active (is_active)
-                          ) {$charset_collate};";
</del><ins>+                                KEY is_active (is_active)
+                       ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  dbDelta( $sql );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Install database tables for the Profiles component
+ *
+ * @since BuddyPress (1.0.0)
+ * 
+ * @uses bp_core_set_charset()
+ * @uses bp_core_get_table_prefix()
+ * @uses dbDelta()
+ */
</ins><span class="cx"> function bp_core_install_extended_profiles() {
</span><span class="cx">  global $wpdb;
</span><span class="cx"> 
</span><span class="lines">@@ -260,43 +333,43 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_groups (
</span><del>-                           id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                           name varchar(150) NOT NULL,
-                           description mediumtext NOT NULL,
-                           group_order bigint(20) NOT NULL DEFAULT '0',
-                           can_delete tinyint(1) NOT NULL,
-                           KEY can_delete (can_delete)
-                          ) {$charset_collate};";
</del><ins>+                                id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                               name varchar(150) NOT NULL,
+                               description mediumtext NOT NULL,
+                               group_order bigint(20) NOT NULL DEFAULT '0',
+                               can_delete tinyint(1) NOT NULL,
+                               KEY can_delete (can_delete)
+                       ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_fields (
</span><del>-                           id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                           group_id bigint(20) unsigned NOT NULL,
-                           parent_id bigint(20) unsigned NOT NULL,
-                           type varchar(150) NOT NULL,
-                           name varchar(150) NOT NULL,
-                           description longtext NOT NULL,
-                           is_required tinyint(1) NOT NULL DEFAULT '0',
-                           is_default_option tinyint(1) NOT NULL DEFAULT '0',
-                           field_order bigint(20) NOT NULL DEFAULT '0',
-                           option_order bigint(20) NOT NULL DEFAULT '0',
-                           order_by varchar(15) NOT NULL DEFAULT '',
-                           can_delete tinyint(1) NOT NULL DEFAULT '1',
-                           KEY group_id (group_id),
-                           KEY parent_id (parent_id),
-                           KEY field_order (field_order),
-                           KEY can_delete (can_delete),
-                           KEY is_required (is_required)
-                          ) {$charset_collate};";
</del><ins>+                                id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                               group_id bigint(20) unsigned NOT NULL,
+                               parent_id bigint(20) unsigned NOT NULL,
+                               type varchar(150) NOT NULL,
+                               name varchar(150) NOT NULL,
+                               description longtext NOT NULL,
+                               is_required tinyint(1) NOT NULL DEFAULT '0',
+                               is_default_option tinyint(1) NOT NULL DEFAULT '0',
+                               field_order bigint(20) NOT NULL DEFAULT '0',
+                               option_order bigint(20) NOT NULL DEFAULT '0',
+                               order_by varchar(15) NOT NULL DEFAULT '',
+                               can_delete tinyint(1) NOT NULL DEFAULT '1',
+                               KEY group_id (group_id),
+                               KEY parent_id (parent_id),
+                               KEY field_order (field_order),
+                               KEY can_delete (can_delete),
+                               KEY is_required (is_required)
+                       ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_data (
</span><del>-                           id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                           field_id bigint(20) unsigned NOT NULL,
-                           user_id bigint(20) unsigned NOT NULL,
-                           value longtext NOT NULL,
-                           last_updated datetime NOT NULL,
-                           KEY field_id (field_id),
-                           KEY user_id (user_id)
-                          ) {$charset_collate};";
</del><ins>+                                id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                               field_id bigint(20) unsigned NOT NULL,
+                               user_id bigint(20) unsigned NOT NULL,
+                               value longtext NOT NULL,
+                               last_updated datetime NOT NULL,
+                               KEY field_id (field_id),
+                               KEY user_id (user_id)
+                       ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_meta (
</span><span class="cx">                          id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
</span><span class="lines">@@ -306,35 +379,45 @@
</span><span class="cx">                          meta_value longtext DEFAULT NULL,
</span><span class="cx">                          KEY object_id (object_id),
</span><span class="cx">                          KEY meta_key (meta_key)
</span><del>-                          ) {$charset_collate};";
</del><ins>+                        ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  dbDelta( $sql );
</span><span class="cx"> 
</span><span class="cx">  // Insert the default group and fields
</span><span class="cx">  $insert_sql = array();
</span><span class="cx"> 
</span><del>-       if ( !$wpdb->get_var( "SELECT id FROM {$bp_prefix}bp_xprofile_groups WHERE id = 1" ) )
</del><ins>+        if ( ! $wpdb->get_var( "SELECT id FROM {$bp_prefix}bp_xprofile_groups WHERE id = 1" ) ) {
</ins><span class="cx">           $insert_sql[] = "INSERT INTO {$bp_prefix}bp_xprofile_groups ( name, description, can_delete ) VALUES ( " . $wpdb->prepare( '%s', stripslashes( bp_get_option( 'bp-xprofile-base-group-name' ) ) ) . ", '', 0 );";
</span><ins>+       }
</ins><span class="cx"> 
</span><del>-       if ( !$wpdb->get_var( "SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE id = 1" ) )
</del><ins>+        if ( ! $wpdb->get_var( "SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE id = 1" ) ) {
</ins><span class="cx">           $insert_sql[] = "INSERT INTO {$bp_prefix}bp_xprofile_fields ( group_id, parent_id, type, name, description, is_required, can_delete ) VALUES ( 1, 0, 'textbox', " . $wpdb->prepare( '%s', stripslashes( bp_get_option( 'bp-xprofile-fullname-field-name' ) ) ) . ", '', 1, 0 );";
</span><ins>+       }
</ins><span class="cx"> 
</span><span class="cx">  dbDelta( $insert_sql );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Install database tables for the Sites component
+ *
+ * @since BuddyPress (1.0.0)
+ * 
+ * @uses bp_core_set_charset()
+ * @uses bp_core_get_table_prefix()
+ * @uses dbDelta()
+ */
</ins><span class="cx"> function bp_core_install_blog_tracking() {
</span><del>-
</del><span class="cx">   $sql             = array();
</span><span class="cx">  $charset_collate = bp_core_set_charset();
</span><span class="cx">  $bp_prefix       = bp_core_get_table_prefix();
</span><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_user_blogs (
</span><del>-                           id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                           user_id bigint(20) NOT NULL,
-                           blog_id bigint(20) NOT NULL,
-                           KEY user_id (user_id),
-                           KEY blog_id (blog_id)
-                      ) {$charset_collate};";
</del><ins>+                                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                               user_id bigint(20) NOT NULL,
+                               blog_id bigint(20) NOT NULL,
+                               KEY user_id (user_id),
+                               KEY blog_id (blog_id)
+                       ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  $sql[] = "CREATE TABLE {$bp_prefix}bp_user_blogs_blogmeta (
</span><span class="cx">                          id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
</span><span class="lines">@@ -343,7 +426,7 @@
</span><span class="cx">                          meta_value longtext DEFAULT NULL,
</span><span class="cx">                          KEY blog_id (blog_id),
</span><span class="cx">                          KEY meta_key (meta_key)
</span><del>-                      ) {$charset_collate};";
</del><ins>+                        ) {$charset_collate};";
</ins><span class="cx"> 
</span><span class="cx">  dbDelta( $sql );
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>