bb_set_custom_user_tables

Sets the required variables to connect to custom user tables.

Description

(boolean) bb_set_custom_user_tables(); 

Returns (boolean)

Always returns true.


Usage

  1. if ( !function_exists( 'bb_set_custom_user_tables' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bb_set_custom_user_tables(); 
  7.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-core.php  
  1. function bb_set_custom_user_tables() 
  2. global $bb; 
  3.  
  4. // Check for older style custom user table 
  5. if ( !isset( $bb->custom_tables['users'] ) ) { // Don't stomp new setting style 
  6. if ( $bb->custom_user_table = bb_get_option( 'custom_user_table' ) ) { 
  7. if ( !isset( $bb->custom_tables ) ) { 
  8. $bb->custom_tables = array(); 
  9. $bb->custom_tables['users'] = $bb->custom_user_table; 
  10.  
  11. // Check for older style custom user meta table 
  12. if ( !isset( $bb->custom_tables['usermeta'] ) ) { // Don't stomp new setting style 
  13. if ( $bb->custom_user_meta_table = bb_get_option( 'custom_user_meta_table' ) ) { 
  14. if ( !isset( $bb->custom_tables ) ) { 
  15. $bb->custom_tables = array(); 
  16. $bb->custom_tables['usermeta'] = $bb->custom_user_meta_table; 
  17.  
  18. // Check for older style wp_table_prefix 
  19. if ( $bb->wp_table_prefix = bb_get_option( 'wp_table_prefix' ) ) { // User has set old constant 
  20. if ( !isset( $bb->custom_tables ) ) { 
  21. $bb->custom_tables = array( 
  22. 'users' => $bb->wp_table_prefix . 'users',  
  23. 'usermeta' => $bb->wp_table_prefix . 'usermeta' 
  24. ); 
  25. } else { 
  26. if ( !isset( $bb->custom_tables['users'] ) ) { // Don't stomp new setting style 
  27. $bb->custom_tables['users'] = $bb->wp_table_prefix . 'users'; 
  28. if ( !isset( $bb->custom_tables['usermeta'] ) ) { 
  29. $bb->custom_tables['usermeta'] = $bb->wp_table_prefix . 'usermeta'; 
  30.  
  31. if ( bb_get_option( 'wordpress_mu_primary_blog_id' ) ) { 
  32. $bb->wordpress_mu_primary_blog_id = bb_get_option( 'wordpress_mu_primary_blog_id' ); 
  33.  
  34. // Check for older style user database 
  35. if ( !isset( $bb->custom_databases ) ) { 
  36. $bb->custom_databases = array(); 
  37. if ( !isset( $bb->custom_databases['user'] ) ) { 
  38. if ( $bb->user_bbdb_name = bb_get_option( 'user_bbdb_name' ) ) { 
  39. $bb->custom_databases['user']['name'] = $bb->user_bbdb_name; 
  40. if ( $bb->user_bbdb_user = bb_get_option( 'user_bbdb_user' ) ) { 
  41. $bb->custom_databases['user']['user'] = $bb->user_bbdb_user; 
  42. if ( $bb->user_bbdb_password = bb_get_option( 'user_bbdb_password' ) ) { 
  43. $bb->custom_databases['user']['password'] = $bb->user_bbdb_password; 
  44. if ( $bb->user_bbdb_host = bb_get_option( 'user_bbdb_host' ) ) { 
  45. $bb->custom_databases['user']['host'] = $bb->user_bbdb_host; 
  46. if ( $bb->user_bbdb_charset = bb_get_option( 'user_bbdb_charset' ) ) { 
  47. $bb->custom_databases['user']['charset'] = $bb->user_bbdb_charset; 
  48. if ( $bb->user_bbdb_collate = bb_get_option( 'user_bbdb_collate' ) ) { 
  49. $bb->custom_databases['user']['collate'] = $bb->user_bbdb_collate; 
  50. if ( isset( $bb->custom_databases['user'] ) ) { 
  51. if ( isset( $bb->custom_tables['users'] ) ) { 
  52. $bb->custom_tables['users'] = array( 'user', $bb->custom_tables['users'] ); 
  53. if ( isset( $bb->custom_tables['usermeta'] ) ) { 
  54. $bb->custom_tables['usermeta'] = array( 'user', $bb->custom_tables['usermeta'] ); 
  55.  
  56. return true;