Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/02/2018 06:07:46 PM (4 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-blogs/bp-blogs-functions.php

    r12173 r12180  
    13031303    // Legacy - if no meta_key is passed, delete all for the blog_id.
    13041304    if ( empty( $meta_key ) ) {
    1305         $keys = $wpdb->get_col( $wpdb->prepare( "SELECT meta_key FROM {$wpdb->bp_blogmeta} WHERE blog_id = %d", $blog_id ) );
     1305        $table_name = buddypress()->blogs->table_name_blogmeta;
     1306        $sql        = "SELECT meta_key FROM {$table_name} WHERE blog_id = %d";
     1307        $query      = $wpdb->prepare( $sql, $blog_id );
     1308        $keys       = $wpdb->get_col( $query );
     1309
     1310        // With no meta_key, ignore $delete_all.
    13061311        $delete_all = false;
    13071312    } else {
Note: See TracChangeset for help on using the changeset viewer.