[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/admin/ -> bp-core-admin-schema.php (source)

   1  <?php
   2  /**
   3   * BuddyPress DB schema.
   4   *
   5   * @package BuddyPress
   6   * @subpackage CoreAdministration
   7   * @since 2.3.0
   8   */
   9  
  10  // Exit if accessed directly.
  11  defined( 'ABSPATH' ) || exit;
  12  
  13  /**
  14   * Main installer.
  15   *
  16   * Can be passed an optional array of components to explicitly run installation
  17   * routines on, typically the first time a component is activated in Settings.
  18   *
  19   * @since 1.0.0
  20   *
  21   * @param array|bool $active_components Components to install.
  22   */
  23  function bp_core_install( $active_components = false ) {
  24  
  25      bp_pre_schema_upgrade();
  26  
  27      // If no components passed, get all the active components from the main site.
  28      if ( empty( $active_components ) ) {
  29  
  30          /** This filter is documented in bp-core/admin/bp-core-admin-components.php */
  31          $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );
  32      }
  33  
  34      // Install Activity Streams even when inactive (to store last_activity data).
  35      bp_core_install_activity_streams();
  36  
  37      // Install the signups table.
  38      bp_core_maybe_install_signups();
  39  
  40      // Notifications.
  41      if ( !empty( $active_components['notifications'] ) ) {
  42          bp_core_install_notifications();
  43      }
  44  
  45      // Friend Connections.
  46      if ( !empty( $active_components['friends'] ) ) {
  47          bp_core_install_friends();
  48      }
  49  
  50      // Extensible Groups.
  51      if ( !empty( $active_components['groups'] ) ) {
  52          bp_core_install_groups();
  53      }
  54  
  55      // Private Messaging.
  56      if ( !empty( $active_components['messages'] ) ) {
  57          bp_core_install_private_messaging();
  58      }
  59  
  60      // Extended Profiles.
  61      if ( !empty( $active_components['xprofile'] ) ) {
  62          bp_core_install_extended_profiles();
  63      }
  64  
  65      // Blog tracking.
  66      if ( !empty( $active_components['blogs'] ) ) {
  67          bp_core_install_blog_tracking();
  68      }
  69  }
  70  
  71  /**
  72   * Install database tables for the Notifications component.
  73   *
  74   * @since 1.0.0
  75   *
  76   */
  77  function bp_core_install_notifications() {
  78      $sql             = array();
  79      $charset_collate = $GLOBALS['wpdb']->get_charset_collate();
  80      $bp_prefix       = bp_core_get_table_prefix();
  81  
  82      $sql[] = "CREATE TABLE {$bp_prefix}bp_notifications (
  83                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  84                  user_id bigint(20) NOT NULL,
  85                  item_id bigint(20) NOT NULL,
  86                  secondary_item_id bigint(20),
  87                  component_name varchar(75) NOT NULL,
  88                  component_action varchar(75) NOT NULL,
  89                  date_notified datetime NOT NULL,
  90                  is_new bool NOT NULL DEFAULT 0,
  91                  KEY item_id (item_id),
  92                  KEY secondary_item_id (secondary_item_id),
  93                  KEY user_id (user_id),
  94                  KEY is_new (is_new),
  95                  KEY component_name (component_name),
  96                  KEY component_action (component_action),
  97                  KEY useritem (user_id,is_new)
  98              ) {$charset_collate};";
  99  
 100      $sql[] = "CREATE TABLE {$bp_prefix}bp_notifications_meta (
 101                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 102                  notification_id bigint(20) NOT NULL,
 103                  meta_key varchar(255) DEFAULT NULL,
 104                  meta_value longtext DEFAULT NULL,
 105                  KEY notification_id (notification_id),
 106                  KEY meta_key (meta_key(191))
 107              ) {$charset_collate};";
 108  
 109      dbDelta( $sql );
 110  }
 111  
 112  /**
 113   * Install database tables for the Activity component.
 114   *
 115   * @since 1.0.0
 116   *
 117   */
 118  function bp_core_install_activity_streams() {
 119      $sql             = array();
 120      $charset_collate = $GLOBALS['wpdb']->get_charset_collate();
 121      $bp_prefix       = bp_core_get_table_prefix();
 122  
 123      $sql[] = "CREATE TABLE {$bp_prefix}bp_activity (
 124                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 125                  user_id bigint(20) NOT NULL,
 126                  component varchar(75) NOT NULL,
 127                  type varchar(75) NOT NULL,
 128                  action text NOT NULL,
 129                  content longtext NOT NULL,
 130                  primary_link text NOT NULL,
 131                  item_id bigint(20) NOT NULL,
 132                  secondary_item_id bigint(20) DEFAULT NULL,
 133                  date_recorded datetime NOT NULL,
 134                  hide_sitewide bool DEFAULT 0,
 135                  mptt_left int(11) NOT NULL DEFAULT 0,
 136                  mptt_right int(11) NOT NULL DEFAULT 0,
 137                  is_spam tinyint(1) NOT NULL DEFAULT 0,
 138                  KEY date_recorded (date_recorded),
 139                  KEY user_id (user_id),
 140                  KEY item_id (item_id),
 141                  KEY secondary_item_id (secondary_item_id),
 142                  KEY component (component),
 143                  KEY type (type),
 144                  KEY mptt_left (mptt_left),
 145                  KEY mptt_right (mptt_right),
 146                  KEY hide_sitewide (hide_sitewide),
 147                  KEY is_spam (is_spam)
 148              ) {$charset_collate};";
 149  
 150      $sql[] = "CREATE TABLE {$bp_prefix}bp_activity_meta (
 151                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 152                  activity_id bigint(20) NOT NULL,
 153                  meta_key varchar(255) DEFAULT NULL,
 154                  meta_value longtext DEFAULT NULL,
 155                  KEY activity_id (activity_id),
 156                  KEY meta_key (meta_key(191))
 157              ) {$charset_collate};";
 158  
 159      dbDelta( $sql );
 160  }
 161  
 162  /**
 163   * Install database tables for the Notifications component.
 164   *
 165   * @since 1.0.0
 166   *
 167   */
 168  function bp_core_install_friends() {
 169      $sql             = array();
 170      $charset_collate = $GLOBALS['wpdb']->get_charset_collate();
 171      $bp_prefix       = bp_core_get_table_prefix();
 172  
 173      $sql[] = "CREATE TABLE {$bp_prefix}bp_friends (
 174                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 175                  initiator_user_id bigint(20) NOT NULL,
 176                  friend_user_id bigint(20) NOT NULL,
 177                  is_confirmed bool DEFAULT 0,
 178                  is_limited bool DEFAULT 0,
 179                  date_created datetime NOT NULL,
 180                  KEY initiator_user_id (initiator_user_id),
 181                  KEY friend_user_id (friend_user_id)
 182              ) {$charset_collate};";
 183  
 184      dbDelta( $sql );
 185  }
 186  
 187  /**
 188   * Install database tables for the Groups component.
 189   *
 190   * @since 1.0.0
 191   *
 192   */
 193  function bp_core_install_groups() {
 194      $sql             = array();
 195      $charset_collate = $GLOBALS['wpdb']->get_charset_collate();
 196      $bp_prefix       = bp_core_get_table_prefix();
 197  
 198      $sql[] = "CREATE TABLE {$bp_prefix}bp_groups (
 199                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 200                  creator_id bigint(20) NOT NULL,
 201                  name varchar(100) NOT NULL,
 202                  slug varchar(200) NOT NULL,
 203                  description longtext NOT NULL,
 204                  status varchar(10) NOT NULL DEFAULT 'public',
 205                  parent_id bigint(20) NOT NULL DEFAULT 0,
 206                  enable_forum tinyint(1) NOT NULL DEFAULT '1',
 207                  date_created datetime NOT NULL,
 208                  KEY creator_id (creator_id),
 209                  KEY status (status),
 210                  KEY parent_id (parent_id)
 211              ) {$charset_collate};";
 212  
 213      $sql[] = "CREATE TABLE {$bp_prefix}bp_groups_members (
 214                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 215                  group_id bigint(20) NOT NULL,
 216                  user_id bigint(20) NOT NULL,
 217                  inviter_id bigint(20) NOT NULL,
 218                  is_admin tinyint(1) NOT NULL DEFAULT '0',
 219                  is_mod tinyint(1) NOT NULL DEFAULT '0',
 220                  user_title varchar(100) NOT NULL,
 221                  date_modified datetime NOT NULL,
 222                  comments longtext NOT NULL,
 223                  is_confirmed tinyint(1) NOT NULL DEFAULT '0',
 224                  is_banned tinyint(1) NOT NULL DEFAULT '0',
 225                  invite_sent tinyint(1) NOT NULL DEFAULT '0',
 226                  KEY group_id (group_id),
 227                  KEY is_admin (is_admin),
 228                  KEY is_mod (is_mod),
 229                  KEY user_id (user_id),
 230                  KEY inviter_id (inviter_id),
 231                  KEY is_confirmed (is_confirmed)
 232              ) {$charset_collate};";
 233  
 234      $sql[] = "CREATE TABLE {$bp_prefix}bp_groups_groupmeta (
 235                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 236                  group_id bigint(20) NOT NULL,
 237                  meta_key varchar(255) DEFAULT NULL,
 238                  meta_value longtext DEFAULT NULL,
 239                  KEY group_id (group_id),
 240                  KEY meta_key (meta_key(191))
 241              ) {$charset_collate};";
 242  
 243      dbDelta( $sql );
 244  }
 245  
 246  /**
 247   * Install database tables for the Messages component.
 248   *
 249   * @since 1.0.0
 250   *
 251   */
 252  function bp_core_install_private_messaging() {
 253      $sql             = array();
 254      $charset_collate = $GLOBALS['wpdb']->get_charset_collate();
 255      $bp_prefix       = bp_core_get_table_prefix();
 256  
 257      $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_messages (
 258                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 259                  thread_id bigint(20) NOT NULL,
 260                  sender_id bigint(20) NOT NULL,
 261                  subject varchar(200) NOT NULL,
 262                  message longtext NOT NULL,
 263                  date_sent datetime NOT NULL,
 264                  KEY sender_id (sender_id),
 265                  KEY thread_id (thread_id)
 266              ) {$charset_collate};";
 267  
 268      $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_recipients (
 269                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 270                  user_id bigint(20) NOT NULL,
 271                  thread_id bigint(20) NOT NULL,
 272                  unread_count int(10) NOT NULL DEFAULT '0',
 273                  sender_only tinyint(1) NOT NULL DEFAULT '0',
 274                  is_deleted tinyint(1) NOT NULL DEFAULT '0',
 275                  KEY user_id (user_id),
 276                  KEY thread_id (thread_id),
 277                  KEY is_deleted (is_deleted),
 278                  KEY sender_only (sender_only),
 279                  KEY unread_count (unread_count)
 280              ) {$charset_collate};";
 281  
 282      $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_notices (
 283                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 284                  subject varchar(200) NOT NULL,
 285                  message longtext NOT NULL,
 286                  date_sent datetime NOT NULL,
 287                  is_active tinyint(1) NOT NULL DEFAULT '0',
 288                  KEY is_active (is_active)
 289              ) {$charset_collate};";
 290  
 291      $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_meta (
 292                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 293                  message_id bigint(20) NOT NULL,
 294                  meta_key varchar(255) DEFAULT NULL,
 295                  meta_value longtext DEFAULT NULL,
 296                  KEY message_id (message_id),
 297                  KEY meta_key (meta_key(191))
 298              ) {$charset_collate};";
 299  
 300      dbDelta( $sql );
 301  }
 302  
 303  /**
 304   * Install database tables for the Profiles component.
 305   *
 306   * @since 1.0.0
 307   *
 308   */
 309  function bp_core_install_extended_profiles() {
 310      global $wpdb;
 311  
 312      $sql             = array();
 313      $charset_collate = $GLOBALS['wpdb']->get_charset_collate();
 314      $bp_prefix       = bp_core_get_table_prefix();
 315  
 316      // These values should only be updated if they are not already present.
 317      if ( ! bp_get_option( 'bp-xprofile-base-group-name' ) ) {
 318          bp_update_option( 'bp-xprofile-base-group-name', _x( 'General', 'First field-group name', 'buddypress' ) );
 319      }
 320  
 321      if ( ! bp_get_option( 'bp-xprofile-fullname-field-name' ) ) {
 322          bp_update_option( 'bp-xprofile-fullname-field-name', _x( 'Display Name', 'Display name field', 'buddypress' ) );
 323      }
 324  
 325      $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_groups (
 326                  id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
 327                  name varchar(150) NOT NULL,
 328                  description mediumtext NOT NULL,
 329                  group_order bigint(20) NOT NULL DEFAULT '0',
 330                  can_delete tinyint(1) NOT NULL,
 331                  KEY can_delete (can_delete)
 332              ) {$charset_collate};";
 333  
 334      $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_fields (
 335                  id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
 336                  group_id bigint(20) unsigned NOT NULL,
 337                  parent_id bigint(20) unsigned NOT NULL,
 338                  type varchar(150) NOT NULL,
 339                  name varchar(150) NOT NULL,
 340                  description longtext NOT NULL,
 341                  is_required tinyint(1) NOT NULL DEFAULT '0',
 342                  is_default_option tinyint(1) NOT NULL DEFAULT '0',
 343                  field_order bigint(20) NOT NULL DEFAULT '0',
 344                  option_order bigint(20) NOT NULL DEFAULT '0',
 345                  order_by varchar(15) NOT NULL DEFAULT '',
 346                  can_delete tinyint(1) NOT NULL DEFAULT '1',
 347                  KEY group_id (group_id),
 348                  KEY parent_id (parent_id),
 349                  KEY field_order (field_order),
 350                  KEY can_delete (can_delete),
 351                  KEY is_required (is_required)
 352              ) {$charset_collate};";
 353  
 354      $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_data (
 355                  id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
 356                  field_id bigint(20) unsigned NOT NULL,
 357                  user_id bigint(20) unsigned NOT NULL,
 358                  value longtext NOT NULL,
 359                  last_updated datetime NOT NULL,
 360                  KEY field_id (field_id),
 361                  KEY user_id (user_id)
 362              ) {$charset_collate};";
 363  
 364      $sql[] = "CREATE TABLE {$bp_prefix}bp_xprofile_meta (
 365                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 366                  object_id bigint(20) NOT NULL,
 367                  object_type varchar(150) NOT NULL,
 368                  meta_key varchar(255) DEFAULT NULL,
 369                  meta_value longtext DEFAULT NULL,
 370                  KEY object_id (object_id),
 371                  KEY meta_key (meta_key(191))
 372              ) {$charset_collate};";
 373  
 374      dbDelta( $sql );
 375  
 376      // Insert the default group and fields.
 377      $insert_sql = array();
 378  
 379      if ( ! $wpdb->get_var( "SELECT id FROM {$bp_prefix}bp_xprofile_groups WHERE id = 1" ) ) {
 380          $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 );";
 381      }
 382  
 383      if ( ! $wpdb->get_var( "SELECT id FROM {$bp_prefix}bp_xprofile_fields WHERE id = 1" ) ) {
 384          $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 );";
 385  
 386          // Make sure the custom visibility is disabled for the default field.
 387          if ( ! $wpdb->get_var( "SELECT id FROM {$bp_prefix}bp_xprofile_meta WHERE id = 1" ) ) {
 388              $insert_sql[] = "INSERT INTO {$bp_prefix}bp_xprofile_meta ( object_id, object_type, meta_key, meta_value ) VALUES ( 1, 'field', 'allow_custom_visibility', 'disabled' );";
 389          }
 390      }
 391  
 392      dbDelta( $insert_sql );
 393  }
 394  
 395  /**
 396   * Install database tables for the Sites component.
 397   *
 398   * @since 1.0.0
 399   *
 400   */
 401  function bp_core_install_blog_tracking() {
 402      $sql             = array();
 403      $charset_collate = $GLOBALS['wpdb']->get_charset_collate();
 404      $bp_prefix       = bp_core_get_table_prefix();
 405  
 406      $sql[] = "CREATE TABLE {$bp_prefix}bp_user_blogs (
 407                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 408                  user_id bigint(20) NOT NULL,
 409                  blog_id bigint(20) NOT NULL,
 410                  KEY user_id (user_id),
 411                  KEY blog_id (blog_id)
 412              ) {$charset_collate};";
 413  
 414      $sql[] = "CREATE TABLE {$bp_prefix}bp_user_blogs_blogmeta (
 415                  id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 416                  blog_id bigint(20) NOT NULL,
 417                  meta_key varchar(255) DEFAULT NULL,
 418                  meta_value longtext DEFAULT NULL,
 419                  KEY blog_id (blog_id),
 420                  KEY meta_key (meta_key(191))
 421              ) {$charset_collate};";
 422  
 423      dbDelta( $sql );
 424  }
 425  
 426  /** Signups *******************************************************************/
 427  
 428  /**
 429   * Install the signups table.
 430   *
 431   * @since 2.0.0
 432   *
 433   * @global $wpdb
 434   */
 435  function bp_core_install_signups() {
 436      global $wpdb;
 437  
 438      // Signups is not there and we need it so let's create it.
 439      require_once( buddypress()->plugin_dir . '/bp-core/admin/bp-core-admin-schema.php' );
 440      require_once( ABSPATH                  . 'wp-admin/includes/upgrade.php'     );
 441  
 442      // Never use bp_core_get_table_prefix() for any global users tables.
 443      $wpdb->signups = $wpdb->base_prefix . 'signups';
 444  
 445      // Use WP's core CREATE TABLE query.
 446      $create_queries = wp_get_db_schema( 'ms_global' );
 447      if ( ! is_array( $create_queries ) ) {
 448          $create_queries = explode( ';', $create_queries );
 449          $create_queries = array_filter( $create_queries );
 450      }
 451  
 452      // Filter out all the queries except wp_signups.
 453      foreach ( $create_queries as $key => $query ) {
 454          if ( preg_match( "|CREATE TABLE ([^ ]*)|", $query, $matches ) ) {
 455              if ( trim( $matches[1], '`' ) !== $wpdb->signups ) {
 456                  unset( $create_queries[ $key ] );
 457              }
 458          }
 459      }
 460  
 461      // Run WordPress's database upgrader.
 462      if ( ! empty( $create_queries ) ) {
 463          dbDelta( $create_queries );
 464      }
 465  }
 466  
 467  /**
 468   * Update the signups table, adding `signup_id` column and drop `domain` index.
 469   *
 470   * This is necessary because WordPress's `pre_schema_upgrade()` function wraps
 471   * table ALTER's in multisite checks, and other plugins may have installed their
 472   * own sign-ups table; Eg: Gravity Forms User Registration Add On.
 473   *
 474   * @since 2.0.1
 475   *
 476   * @see pre_schema_upgrade()
 477   * @link https://core.trac.wordpress.org/ticket/27855 WordPress Trac Ticket
 478   * @link https://buddypress.trac.wordpress.org/ticket/5563 BuddyPress Trac Ticket
 479   *
 480   * @global WPDB $wpdb
 481   */
 482  function bp_core_upgrade_signups() {
 483      global $wpdb;
 484  
 485      // Bail if global tables should not be upgraded.
 486      if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
 487          return;
 488      }
 489  
 490      // Never use bp_core_get_table_prefix() for any global users tables.
 491      $wpdb->signups = $wpdb->base_prefix . 'signups';
 492  
 493      // Attempt to alter the signups table.
 494      $wpdb->query( "ALTER TABLE {$wpdb->signups} ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" );
 495      $wpdb->query( "ALTER TABLE {$wpdb->signups} DROP INDEX domain" );
 496  }
 497  
 498  /**
 499   * Add default emails.
 500   *
 501   * @since 2.5.0
 502   */
 503  function bp_core_install_emails() {
 504      $defaults = array(
 505          'post_status' => 'publish',
 506          'post_type'   => bp_get_email_post_type(),
 507      );
 508  
 509      $emails       = bp_email_get_schema();
 510      $descriptions = bp_email_get_type_schema( 'description' );
 511  
 512      // Add these emails to the database.
 513      foreach ( $emails as $id => $email ) {
 514  
 515          // Some emails are multisite-only.
 516          if ( ! is_multisite() && isset( $email['args'] ) && ! empty( $email['args']['multisite'] ) ) {
 517              continue;
 518          }
 519  
 520          $post_id = wp_insert_post( bp_parse_args( $email, $defaults, 'install_email_' . $id ) );
 521          if ( ! $post_id ) {
 522              continue;
 523          }
 524  
 525          $tt_ids = wp_set_object_terms( $post_id, $id, bp_get_email_tax_type() );
 526          foreach ( $tt_ids as $tt_id ) {
 527              $term = get_term_by( 'term_taxonomy_id', (int) $tt_id, bp_get_email_tax_type() );
 528              wp_update_term( (int) $term->term_id, bp_get_email_tax_type(), array(
 529                  'description' => $descriptions[ $id ],
 530              ) );
 531          }
 532      }
 533  
 534      bp_update_option( 'bp-emails-unsubscribe-salt', base64_encode( wp_generate_password( 64, true, true ) ) );
 535  
 536      /**
 537       * Fires after BuddyPress adds the posts for its emails.
 538       *
 539       * @since 2.5.0
 540       */
 541      do_action( 'bp_core_install_emails' );
 542  }
 543  
 544  /**
 545   * Install database tables for the Invitations API
 546   *
 547   * @since 5.0.0
 548   *
 549   * @uses bp_core_set_charset()
 550   * @uses bp_core_get_table_prefix()
 551   * @uses dbDelta()
 552   */
 553  function bp_core_install_invitations() {
 554      $sql             = array();
 555      $charset_collate = $GLOBALS['wpdb']->get_charset_collate();
 556      $bp_prefix       = bp_core_get_table_prefix();
 557      $sql[] = "CREATE TABLE {$bp_prefix}bp_invitations (
 558          id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 559          user_id bigint(20) NOT NULL,
 560          inviter_id bigint(20) NOT NULL,
 561          invitee_email varchar(100) DEFAULT NULL,
 562          class varchar(120) NOT NULL,
 563          item_id bigint(20) NOT NULL,
 564          secondary_item_id bigint(20) DEFAULT NULL,
 565          type varchar(12) NOT NULL DEFAULT 'invite',
 566          content longtext DEFAULT '',
 567          date_modified datetime NOT NULL,
 568          invite_sent tinyint(1) NOT NULL DEFAULT '0',
 569          accepted tinyint(1) NOT NULL DEFAULT '0',
 570          KEY user_id (user_id),
 571          KEY inviter_id (inviter_id),
 572          KEY invitee_email (invitee_email),
 573          KEY class (class),
 574          KEY item_id (item_id),
 575          KEY secondary_item_id (secondary_item_id),
 576          KEY type (type),
 577          KEY invite_sent (invite_sent),
 578          KEY accepted (accepted)
 579          ) {$charset_collate};";
 580      dbDelta( $sql );
 581  
 582      /**
 583       * Fires after BuddyPress adds the invitations table.
 584       *
 585       * @since 5.0.0
 586       */
 587      do_action( 'bp_core_install_invitations' );
 588  }


Generated: Thu Sep 19 01:01:39 2019 Cross-referenced by PHPXref 0.7.1