bp_core_install_notifications

Install database tables for the Notifications component.

Description

bp_core_install_notifications(); 

Usage

  1. if ( !function_exists( 'bp_core_install_notifications' ) ) { 
  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_notifications(); 
  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_notifications() { 
  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_notifications ( 
  7. id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,  
  8. user_id bigint(20) NOT NULL,  
  9. item_id bigint(20) NOT NULL,  
  10. secondary_item_id bigint(20),  
  11. component_name varchar(75) NOT NULL,  
  12. component_action varchar(75) NOT NULL,  
  13. date_notified datetime NOT NULL,  
  14. is_new bool NOT NULL DEFAULT 0,  
  15. KEY item_id (item_id),  
  16. KEY secondary_item_id (secondary_item_id),  
  17. KEY user_id (user_id),  
  18. KEY is_new (is_new),  
  19. KEY component_name (component_name),  
  20. KEY component_action (component_action),  
  21. KEY useritem (user_id, is_new) 
  22. ) {$charset_collate};"; 
  23.  
  24. $sql[] = "CREATE TABLE {$bp_prefix}bp_notifications_meta ( 
  25. id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,  
  26. notification_id bigint(20) NOT NULL,  
  27. meta_key varchar(255) DEFAULT NULL,  
  28. meta_value longtext DEFAULT NULL,  
  29. KEY notification_id (notification_id),  
  30. KEY meta_key (meta_key(191)) 
  31. ) {$charset_collate};"; 
  32.  
  33. dbDelta( $sql );