Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/14/2014 01:59:32 PM (11 years ago)
Author:
boonebgorges
Message:

Add support for $single param in _get_meta() functions

Unlike get_metadata(), we are defaulting to $single = true, for backward
compatibility.

See #5400

File:
1 edited

Legend:

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

    r7878 r7879  
    582582 * Get a piece of xprofile metadata.
    583583 *
     584 * Note that the default value of $single is true, unlike in the case of the
     585 * underlying get_metadata() function. This is for backward compatibility.
     586 *
    584587 * @param int $object_id ID of the object the metadata belongs to.
    585588 * @param string $object_type Type of object. 'group', 'field', or 'data'.
    586589 * @param string $meta_key Key of the metadata being fetched. If omitted, all
    587590 *        metadata for the object will be retrieved.
     591 * @param bool $single Optional. If true, return only the first value of the
     592 *    specified meta_key. This parameter has no effect if meta_key is not
     593 *    specified. Default: true.
    588594 * @return mixed Meta value if found. False on failure.
    589595 */
    590 function bp_xprofile_get_meta( $object_id, $object_type, $meta_key = '') {
     596function bp_xprofile_get_meta( $object_id, $object_type, $meta_key = '', $single = true ) {
    591597    // Legacy - sanitize object type
    592598    if ( ! in_array( $object_type, array( 'group', 'field', 'data' ) ) ) {
     
    596602    add_filter( 'query', 'bp_filter_metaid_column_name' );
    597603    add_filter( 'query', 'bp_xprofile_filter_meta_query' );
    598     $retval = get_metadata( 'xprofile_' . $object_type, $object_id, $meta_key, true );
     604    $retval = get_metadata( 'xprofile_' . $object_type, $object_id, $meta_key, $single );
    599605    remove_filter( 'query', 'bp_filter_metaid_column_name' );
    600606    remove_filter( 'query', 'bp_xprofile_filter_meta_query' );
Note: See TracChangeset for help on using the changeset viewer.