Skip to:
Content

BuddyPress.org

Changeset 7576


Ignore:
Timestamp:
11/15/2013 09:08:20 PM (11 years ago)
Author:
boonebgorges
Message:

Allow 0 to be stored in activitymeta

Previously, any value where empty( $value ) evaluated to true would result
in the deletion of the row. This change allows for 0 to be stored as a
legitimate value.

This is a stopgap until BP's meta functions are refactored to use WP's core
*_metadata() functions.

Fixes #5083

Location:
trunk
Files:
2 edited

Legend:

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

    r7570 r7576  
    747747    $meta_value = maybe_serialize( $meta_value );
    748748
    749     // If value is empty, delete the meta key
    750     if ( empty( $meta_value ) )
     749    // If value is false, delete the meta key
     750    if ( false === $meta_value )
    751751        return bp_activity_delete_meta( $activity_id, $meta_key );
    752752
  • trunk/tests/testcases/activity/functions.php

    r7570 r7576  
    103103
    104104    /**
     105     * @group bp_activity_update_meta
     106     * @ticket BP5083
     107     */
     108    public function test_bp_activity_update_meta_with_0() {
     109        $a = $this->factory->activity->create();
     110        $meta_value = 0;
     111
     112        bp_activity_update_meta( $a, '0_test', $meta_value );
     113
     114        $this->assertNotSame( false, bp_activity_get_meta( $a, '0_test' ) );
     115    }
     116
     117    /**
    105118     * @group bp_activity_get_user_mentionname
    106119     */
Note: See TracChangeset for help on using the changeset viewer.