bp_core_install_private_messaging

Install database tables for the Messages component.

Description

bp_core_install_private_messaging(); 

Usage

  1. if ( !function_exists( 'bp_core_install_private_messaging' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/admin/bp-core-admin-schema.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_install_private_messaging(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-core/admin/bp-core-admin-schema.php  
  1. function bp_core_install_private_messaging() { 
  2. $sql = array(); 
  3. $charset_collate = $GLOBALS['wpdb']->get_charset_collate(); 
  4. $bp_prefix = bp_core_get_table_prefix(); 
  5.  
  6. $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_messages ( 
  7. id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,  
  8. thread_id bigint(20) NOT NULL,  
  9. sender_id bigint(20) NOT NULL,  
  10. subject varchar(200) NOT NULL,  
  11. message longtext NOT NULL,  
  12. date_sent datetime NOT NULL,  
  13. KEY sender_id (sender_id),  
  14. KEY thread_id (thread_id) 
  15. ) {$charset_collate};"; 
  16.  
  17. $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_recipients ( 
  18. id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,  
  19. user_id bigint(20) NOT NULL,  
  20. thread_id bigint(20) NOT NULL,  
  21. unread_count int(10) NOT NULL DEFAULT '0',  
  22. sender_only tinyint(1) NOT NULL DEFAULT '0',  
  23. is_deleted tinyint(1) NOT NULL DEFAULT '0',  
  24. KEY user_id (user_id),  
  25. KEY thread_id (thread_id),  
  26. KEY is_deleted (is_deleted),  
  27. KEY sender_only (sender_only),  
  28. KEY unread_count (unread_count) 
  29. ) {$charset_collate};"; 
  30.  
  31. $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_notices ( 
  32. id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,  
  33. subject varchar(200) NOT NULL,  
  34. message longtext NOT NULL,  
  35. date_sent datetime NOT NULL,  
  36. is_active tinyint(1) NOT NULL DEFAULT '0',  
  37. KEY is_active (is_active) 
  38. ) {$charset_collate};"; 
  39.  
  40. $sql[] = "CREATE TABLE {$bp_prefix}bp_messages_meta ( 
  41. id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,  
  42. message_id bigint(20) NOT NULL,  
  43. meta_key varchar(255) DEFAULT NULL,  
  44. meta_value longtext DEFAULT NULL,  
  45. KEY message_id (message_id),  
  46. KEY meta_key (meta_key(191)) 
  47. ) {$charset_collate};"; 
  48.  
  49. dbDelta( $sql );