bp_core_install_groups

Install database tables for the Groups component.

Description

bp_core_install_groups(); 

Usage

  1. if ( !function_exists( 'bp_core_install_groups' ) ) { 
  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_groups(); 
  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_groups() { 
  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_groups ( 
  7. id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,  
  8. creator_id bigint(20) NOT NULL,  
  9. name varchar(100) NOT NULL,  
  10. slug varchar(200) NOT NULL,  
  11. description longtext NOT NULL,  
  12. status varchar(10) NOT NULL DEFAULT 'public',  
  13. parent_id bigint(20) NOT NULL DEFAULT 0,  
  14. enable_forum tinyint(1) NOT NULL DEFAULT '1',  
  15. date_created datetime NOT NULL,  
  16. KEY creator_id (creator_id),  
  17. KEY status (status),  
  18. KEY parent_id (parent_id) 
  19. ) {$charset_collate};"; 
  20.  
  21. $sql[] = "CREATE TABLE {$bp_prefix}bp_groups_members ( 
  22. id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,  
  23. group_id bigint(20) NOT NULL,  
  24. user_id bigint(20) NOT NULL,  
  25. inviter_id bigint(20) NOT NULL,  
  26. is_admin tinyint(1) NOT NULL DEFAULT '0',  
  27. is_mod tinyint(1) NOT NULL DEFAULT '0',  
  28. user_title varchar(100) NOT NULL,  
  29. date_modified datetime NOT NULL,  
  30. comments longtext NOT NULL,  
  31. is_confirmed tinyint(1) NOT NULL DEFAULT '0',  
  32. is_banned tinyint(1) NOT NULL DEFAULT '0',  
  33. invite_sent tinyint(1) NOT NULL DEFAULT '0',  
  34. KEY group_id (group_id),  
  35. KEY is_admin (is_admin),  
  36. KEY is_mod (is_mod),  
  37. KEY user_id (user_id),  
  38. KEY inviter_id (inviter_id),  
  39. KEY is_confirmed (is_confirmed) 
  40. ) {$charset_collate};"; 
  41.  
  42. $sql[] = "CREATE TABLE {$bp_prefix}bp_groups_groupmeta ( 
  43. id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,  
  44. group_id bigint(20) NOT NULL,  
  45. meta_key varchar(255) DEFAULT NULL,  
  46. meta_value longtext DEFAULT NULL,  
  47. KEY group_id (group_id),  
  48. KEY meta_key (meta_key(191)) 
  49. ) {$charset_collate};"; 
  50.  
  51. dbDelta( $sql );