Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/14/2014 07:21:52 PM (11 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-blogs/bp-blogs-functions.php

    r7883 r7885  
    922922 * @param string $meta_key Key of the metadata being updated.
    923923 * @param mixed $meta_value Value to be set.
     924 * @param mixed $prev_value Optional. If specified, only update existing
     925 *        metadata entries with the specified value. Otherwise, update all
     926 *        entries.
    924927 * @return bool True on success, false on failure.
    925928 */
    926 function bp_blogs_update_blogmeta( $blog_id, $meta_key, $meta_value ) {
     929function bp_blogs_update_blogmeta( $blog_id, $meta_key, $meta_value, $prev_value = '' ) {
    927930
    928931    // Legacy - Sanitize meta_key
     
    930933
    931934    add_filter( 'query', 'bp_filter_metaid_column_name' );
    932     $retval = update_metadata( 'blog', $blog_id, $meta_key, $meta_value );
     935    $retval = update_metadata( 'blog', $blog_id, $meta_key, $meta_value, $prev_value );
    933936    remove_filter( 'query', 'bp_filter_metaid_column_name' );
    934937
Note: See TracChangeset for help on using the changeset viewer.