Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/14/2014 01:04:58 AM (11 years ago)
Author:
boonebgorges
Message:

Use WP's array format for get_meta() functions when no $meta_key is provided

Passing only an object_id to a get_meta() function in WP will return an array
of arrays, keyed by meta_keys, each containing a list of meta_values for that
meta_key. BP's get_meta() functions were inconsistent in this regard: some
returned arrays of stdClass, some returned one-d arrays of meta_values. All
returned values that were practically of little use, because they didn't have
enough information about the located data to make it useful.

This changeset aligns BP's get_meta() functions with WP's. We now allow the
return value of get_metadata() to pass through untouched in all cases. Unit
tests have been updated as necessary.

See #5399

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/testcases/blogs/functions.php

    r8132 r8133  
    128128        bp_blogs_update_blogmeta( 1, 'foo2', 'bar2' );
    129129
    130         $this->assertSame( array( 'bar', 'bar2', ), bp_blogs_get_blogmeta( 1 ) );
     130        $expected = array(
     131            'foo' => array(
     132                'bar',
     133            ),
     134            'foo2' => array(
     135                'bar2',
     136            ),
     137        );
     138
     139        $this->assertSame( $expected, bp_blogs_get_blogmeta( 1 ) );
    131140    }
    132141
Note: See TracChangeset for help on using the changeset viewer.