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


Generated: Thu Jul 9 01:01:31 2020 Cross-referenced by PHPXref 0.7.1