[buddypress-trac] [BuddyPress Trac] #5951: Add all BP tables to $wpdb

buddypress-trac noreply at wordpress.org
Wed Oct 15 19:17:40 UTC 2014


#5951: Add all BP tables to $wpdb
----------------------------+------------------------------
 Reporter:  slaFFik         |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  All Components  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |
----------------------------+------------------------------
Changes (by slaFFik):

 * cc: slava.abakumov@… (added)
 * keywords:  reporter-feedback =>


Comment:

 And that's the point. It's not consistent - some tables are available in
 `$wpdb`, others are not.
 I have a habit to use `$wpdb` to retrieve DB table names (which is good,
 imo). And now in custom queries where post types are mapped to some groups
 (so `wp_posts`, `wp_postmeta` and `wp_bp_groups` etc in 1 query) I need to
 use different approach in getting table names.

 I strongly believe, that:

 {{{
 $data = $wpdb->get_results($wpdb->prepare("SELECT ... FROM {$wpdb->posts},
 {$wpdb->postmeta}, {$wpdb->bp_groups} WHERE ...", $data));
 }}}

 looks better, than:

 {{{
 $db_bp_groups = buddypress()->groups->table_name;
 $data = $wpdb->get_results($wpdb->prepare("SELECT ... FROM {$wpdb->posts},
 {$wpdb->postmeta}, {$db_bp_groups} WHERE ...", $data));
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5951#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list