Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/02/2018 06:07:46 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Meta: Prefer internal table references over $wpdb ones.

This change updates a few direct database queries to reference the database table names internally set by BP_Component rather than what's been passed into the $wpdb global.

We want to use these everywhere, as they are already in use everywhere else direct queries are made.

Blogs, Groups, and Messages meta deletion functions are affected.

See #7834.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-functions.php

    r12163 r12180  
    21172117    // Legacy - if no meta_key is passed, delete all for the item.
    21182118    if ( empty( $meta_key ) ) {
    2119         $keys = $wpdb->get_col( $wpdb->prepare( "SELECT meta_key FROM {$wpdb->groupmeta} WHERE group_id = %d", $group_id ) );
     2119        $table_name = buddypress()->groups->table_name_groupmeta;
     2120        $sql        = "SELECT meta_key FROM {$table_name} WHERE group_id = %d";
     2121        $query      = $wpdb->prepare( $sql, $group_id );
     2122        $keys       = $wpdb->get_col( $query );
    21202123
    21212124        // With no meta_key, ignore $delete_all.
Note: See TracChangeset for help on using the changeset viewer.