Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/14/2014 12:08:21 PM (10 years ago)
Author:
boonebgorges
Message:

Introduce bp_activity_add_meta()

See #5400

File:
1 edited

Legend:

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

    r7854 r7872  
    668668        $retval = true;
    669669    }
     670
     671    return $retval;
     672}
     673
     674/**
     675 * Add a piece of activity metadata.
     676 *
     677 * @since BuddyPress (2.0.0)
     678 *
     679 * @param int $activity_id ID of the activity item.
     680 * @param string $meta_key Metadata key.
     681 * @param mixed $meta_value Metadata value.
     682 * @param bool $unique. Optional. Whether to enforce a single metadata value
     683 *        for the given key. If true, and the object already has a value for
     684 *        the key, no change will be made. Default: false.
     685 * @return int|bool The meta ID on successful update, false on failure.
     686 */
     687function bp_activity_add_meta( $activity_id, $meta_key, $meta_value, $unique = false ) {
     688    add_filter( 'query', 'bp_filter_metaid_column_name' );
     689    $retval = add_metadata( 'activity', $activity_id, $meta_key, $meta_value, $unique );
     690    remove_filter( 'query', 'bp_filter_metaid_column_name' );
    670691
    671692    return $retval;
Note: See TracChangeset for help on using the changeset viewer.