0

Is there a way to get all users that: 1) uploaded an avatar or 2) have a Gravatar? I want to filter users that doesn't meet one of these conditions.

UPDATE

I forget to mention that this is for Buddypress. Anyway, I found an answer for the first condition, this is the bp_get_user_has_avatar() function that checks if a given user ID has an uploaded avatar.

Now I need only a Gravatar validation for the second condition.

closed as off-topic by kaiser Jan 10 '15 at 14:30

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • How did you "upload an avatar"? Does BuddyPress come with that functionality? – kaiser Jan 10 '15 at 12:09
  • @kaiser By default? I don't know, but in my environment this is already implemented (not by me :)). – Iurie Malai Jan 10 '15 at 14:20
  • 2
    Gravatars are not locally stored or tracked. You would have to make a network request for each user to check. Also if you make a lot of requests to Gravatar service quickly it would block you out, so this won't work reliably. – Rarst Jan 10 '15 at 14:22
  • I read the BuddyPress docs and it seems that the user avatar is a setting there. Could we reduce this question to "Users that have a Gravatar?" If not, then we have a slight problem as BuddyPress isn't part of core and not handled here. – kaiser Jan 10 '15 at 14:24
  • 1
    We don't know as the BP source is highly customized. Please mind the scope: We do not handle 3rd party plugin code here (see: help center). You can try helping yourself (see BuddyPress::bp_core_fetch_avatar() or ask at the BuddyPress support forums. – kaiser Jan 10 '15 at 14:30
1

This function bp_get_user_has_avatar() calls bp_core_fetch_avatar with this argument 'no_grav' => true so you could write your own function to see if a user is not using the default avatar:

function lurie_avatar_check( $user_id ) {
    $retval = false;

    if ( bp_core_fetch_avatar( array( 'item_id' => $user_id, 'no_grav' => false, 'html' => false ) ) != bp_core_avatar_default( 'local' ) )
        $retval = true;

    return $retval;
}
0

http://codex.wordpress.org/Function_Reference/get_avatar

run a user lookup and qualify via get_avatar

Not the answer you're looking for? Browse other questions tagged or ask your own question.