Skip to:
Content

BuddyPress.org

Changeset 8243


Ignore:
Timestamp:
04/06/2014 04:20:31 PM (11 years ago)
Author:
boonebgorges
Message:

Ensure bp_get_user_has_avatar() returns false when the default avatar is returned

Necessitated by changes in return values introduced in r7769

See #5380

Props imath

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-avatars.php

    r8160 r8243  
    10341034
    10351035    $retval = false;
    1036     if ( bp_core_fetch_avatar( array( 'item_id' => $user_id, 'no_grav' => true, 'html' => false ) ) != bp_core_avatar_default() )
     1036    if ( bp_core_fetch_avatar( array( 'item_id' => $user_id, 'no_grav' => true, 'html' => false ) ) != bp_core_avatar_default( 'local' ) )
    10371037        $retval = true;
    10381038
  • trunk/tests/testcases/core/avatars.php

    r8108 r8243  
    5454        $this->go_to( '/' );
    5555    }
     56
     57    /**
     58     * @group bp_get_user_has_avatar
     59     */
     60    public function test_bp_get_user_has_avatar_no_avatar_uploaded() {
     61        $u = $this->create_user();
     62        $this->assertFalse( bp_get_user_has_avatar( $u ) );
     63    }
     64
     65    /**
     66     * @group bp_get_user_has_avatar
     67     */
     68    public function test_bp_get_user_has_avatar_has_avatar_uploaded() {
     69        $u = $this->create_user();
     70
     71        // Fake it
     72        add_filter( 'bp_core_fetch_avatar_url', array( $this, 'avatar_cb' ) );
     73
     74        $this->assertTrue( bp_get_user_has_avatar( $u ) );
     75
     76        remove_filter( 'bp_core_fetch_avatar_url', array( $this, 'avatar_cb' ) );
     77    }
     78
     79    public function avatar_cb() {
     80        return 'foo';
     81    }
    5682}
Note: See TracChangeset for help on using the changeset viewer.