Skip to:
Content

BuddyPress.org

Changeset 10789


Ignore:
Timestamp:
05/19/2016 05:47:22 PM (3 years ago)
Author:
r-a-y
Message:

Notifications: Update meta cache in BP_Notifications_Notification::get().

We update the meta cache if update_meta_cache is true, which it is by
default. Commit also updates the DocBlock to outline a few missing
parameters.

See #6257, #7067.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-notifications/classes/class-bp-notifications-notification.php

    r10303 r10789  
    630630     *     @type int          $per_page          Number of items to show per page. Default:
    631631     *                                           false (no pagination - all items).
     632     *     @type array        $meta_query        Array of meta_query conditions. See WP_Meta_Query::queries.
     633     *     @type array        $date_query        Array of date_query conditions. See first parameter of
     634     *                                           WP_Date_Query::__construct().
     635     *     @type bool         $update_meta_cache Whether to update meta cache. Default: true.
    632636     * }
    633637     * @return array Located notifications.
     
    682686        $sql = "{$select_sql} {$from_sql} {$join_sql} {$where_sql} {$order_sql} {$pag_sql}";
    683687
    684         return $wpdb->get_results( $sql );
     688        $results = $wpdb->get_results( $sql );
     689
     690        // Update meta cache.
     691        if ( true === $r['update_meta_cache'] ) {
     692            bp_notifications_update_meta_cache( wp_list_pluck( $results, 'id' ) );
     693        }
     694
     695        return $results;
    685696    }
    686697
Note: See TracChangeset for help on using the changeset viewer.