Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/14/2014 07:21:52 PM (8 years ago)
Author:
boonebgorges
Message:

Add support for prev_value param to _update_meta() functions

This parameter, inherited from update_metadata(), allows you to limit your
updates only to rows where the meta_value matches your specified prev_value.

See #5400

File:
1 edited

Legend:

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

    r7883 r7885  
    10411041 * @param string $meta_key Metadata key.
    10421042 * @param mixed $meta_value Value to store.
     1043 * @param mixed $prev_value Optional. If specified, only update existing
     1044 *        metadata entries with the specified value. Otherwise, update all
     1045 *        entries.
    10431046 * @return bool True on success, false on failure.
    10441047 */
    1045 function groups_update_groupmeta( $group_id, $meta_key, $meta_value ) {
     1048function groups_update_groupmeta( $group_id, $meta_key, $meta_value, $prev_value = '' ) {
    10461049
    10471050    add_filter( 'query', 'bp_filter_metaid_column_name' );
    1048     $retval = update_metadata( 'group', $group_id, $meta_key, $meta_value );
     1051    $retval = update_metadata( 'group', $group_id, $meta_key, $meta_value, $prev_value );
    10491052    remove_filter( 'query', 'bp_filter_metaid_column_name' );
    10501053
Note: See TracChangeset for help on using the changeset viewer.