bp_get_user_has_avatar( int $user_id )
Check if a given user ID has an uploaded avatar.
Description
Parameters
- $user_id
-
(Required) ID of the user whose avatar is being checked.
Return
(bool) True if the user has uploaded a local avatar. Otherwise false.
Source
File: bp-core/bp-core-avatars.php
1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 | function bp_get_user_has_avatar( $user_id = 0 ) { if ( empty ( $user_id ) ) $user_id = bp_displayed_user_id(); $retval = false; if ( bp_core_fetch_avatar( array ( 'item_id' => $user_id , 'no_grav' => true, 'html' => false, 'type' => 'full' ) ) != bp_core_avatar_default( 'local' ) ) $retval = true; /** * Filters whether or not a user has an uploaded avatar. * * @since BuddyPress 1.6.0 * * @param bool $retval Whether or not a user has an uploaded avatar. * @param int $user_id ID of the user being checked. */ return (bool) apply_filters( 'bp_get_user_has_avatar' , $retval , $user_id ); } |
Changelog
Version | Description |
---|---|
BuddyPress 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.