Skip to:
Content

BuddyPress.org

Changeset 9654


Ignore:
Timestamp:
03/28/2015 03:28:05 PM (10 years ago)
Author:
boonebgorges
Message:

Avoid PHP notices when calling groups_delete_groupmeta() on group with no metadata.

Fixes #6326.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-functions.php

    r9625 r9654  
    16511651    add_filter( 'query', 'bp_filter_metaid_column_name' );
    16521652
     1653    $retval = true;
    16531654    foreach ( $keys as $key ) {
    16541655        $retval = delete_metadata( 'group', $group_id, $key, $meta_value, $delete_all );
  • trunk/tests/phpunit/testcases/groups/functions.php

    r9562 r9654  
    519519     * @group groupmeta
    520520     * @group groups_delete_groupmeta
     521     * @ticket BP6326
     522     */
     523    public function test_groups_delete_groupmeta_with_no_meta_key_when_group_has_metadata() {
     524        global $wpdb;
     525
     526        $g = $this->factory->group->create();
     527        $m = groups_get_groupmeta( $g );
     528        foreach ( $m as $mk => $mv ) {
     529            groups_delete_groupmeta( $g, $mk );
     530        }
     531
     532        $found = groups_delete_groupmeta( $g );
     533        $this->assertTrue( $found );
     534    }
     535
     536    /**
     537     * @group groupmeta
     538     * @group groups_delete_groupmeta
    521539     */
    522540    public function test_groups_delete_groupmeta_with_delete_all_but_no_meta_key() {
Note: See TracChangeset for help on using the changeset viewer.