Changeset 8133
- Timestamp:
- 03/14/2014 01:04:58 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-functions.php
r8132 r8133 580 580 if ( empty( $meta_key ) ) { 581 581 $all_meta = bp_activity_get_meta( $activity_id ); 582 $keys = ! empty( $all_meta ) ? wp_list_pluck( $all_meta, 'meta_key') : array();582 $keys = ! empty( $all_meta ) ? array_keys( $all_meta ) : array(); 583 583 584 584 // With no meta_key, ignore $delete_all … … 625 625 $retval = get_metadata( 'activity', $activity_id, $meta_key, $single ); 626 626 remove_filter( 'query', 'bp_filter_metaid_column_name' ); 627 628 // Legacy - If fetching all meta for a group, just return the first629 // of each found value630 if ( empty( $meta_key ) ) {631 $values = array();632 foreach ( (array) $retval as $rkey => $rvalue ) {633 $rvalue = array_reverse( $rvalue );634 $found = new stdClass;635 $found->meta_key = $rkey;636 $found->meta_value = array_pop( $rvalue );637 $values[] = $found;638 }639 640 // If nothing was found, return empty string641 if ( empty( $values ) ) {642 $retval = '';643 } else {644 $retval = $values;645 }646 }647 627 648 628 // Filter result before returning -
trunk/bp-blogs/bp-blogs-functions.php
r8132 r8133 896 896 remove_filter( 'query', 'bp_filter_metaid_column_name' ); 897 897 898 // Legacy - If no meta_key is passed, return only the found values,899 // not a structured array900 if ( empty( $meta_key ) && is_array( $retval ) ) {901 $values = array();902 foreach ( $retval as $value ) {903 $values[] = array_pop( $value );904 }905 $retval = $values;906 }907 908 898 return $retval; 909 899 } -
trunk/bp-groups/bp-groups-functions.php
r8132 r8133 1075 1075 remove_filter( 'query', 'bp_filter_metaid_column_name' ); 1076 1076 1077 // Legacy - If fetching all meta for a group, just return values1078 if ( empty( $meta_key ) ) {1079 $values = array();1080 foreach ( (array) $retval as $r ) {1081 $values[] = array_pop( $r );1082 }1083 $retval = $values;1084 }1085 1086 1077 return $retval; 1087 1078 } -
trunk/bp-xprofile/bp-xprofile-functions.php
r8132 r8133 641 641 remove_filter( 'query', 'bp_xprofile_filter_meta_query' ); 642 642 643 // Legacy - if no meta_key is provided, return just the located644 // values (not a structured array)645 if ( empty( $meta_key ) && ! empty( $retval ) ) {646 $values = array();647 foreach ( $retval as $v ) {648 $values[] = array_pop( $v );649 }650 651 $retval = $values;652 }653 654 643 return $retval; 655 644 } -
trunk/tests/testcases/activity/functions.php
r8132 r8133 83 83 84 84 // test if activity meta entries still exist 85 $this->assertE quals( false,$m1 );86 $this->assertE quals( false,$m2 );87 $this->assertE quals( false,$m3 );85 $this->assertEmpty( $m1 ); 86 $this->assertEmpty( $m2 ); 87 $this->assertEmpty( $m3 ); 88 88 } 89 89 … … 251 251 bp_activity_update_meta( $a, 'foo1', 'bar1' ); 252 252 253 $am1 = new stdClass;254 $am1->meta_key = 'foo';255 $am1->meta_value = 'bar';256 257 $am2 = new stdClass;258 $am2->meta_key = 'foo1';259 $am2->meta_value = 'bar1';260 261 253 $expected = array( 262 $am1, 263 $am2, 254 'foo' => array( 255 'bar', 256 ), 257 'foo1' => array( 258 'bar1', 259 ), 264 260 ); 265 261 -
trunk/tests/testcases/blogs/functions.php
r8132 r8133 128 128 bp_blogs_update_blogmeta( 1, 'foo2', 'bar2' ); 129 129 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 ) ); 131 140 } 132 141 -
trunk/tests/testcases/groups/functions.php
r8132 r8133 383 383 384 384 $expected = array( 385 'bar', 386 'is cool', 385 'foo' => array( 386 'bar', 387 ), 388 'Boone' => array( 389 'is cool', 390 ), 387 391 ); 388 392 -
trunk/tests/testcases/xprofile/functions.php
r8132 r8133 315 315 bp_xprofile_update_meta( $g, 'group', 'foo2', 'bar' ); 316 316 317 $expected = array( 'bar', 'bar', ); 317 $expected = array( 318 'foo' => array( 319 'bar', 320 ), 321 'foo2' => array( 322 'bar', 323 ), 324 ); 318 325 $this->assertSame( $expected, bp_xprofile_get_meta( $g, 'group' ) ); 319 326 }
Note: See TracChangeset
for help on using the changeset viewer.