We can use the get_avatar_url
filter to modify the avatar’s url.
If all the relevant get_avatar()
calls, have user id as an input argument, then it’s easy to get the corresponding user’s meta value, with get_user_meta()
, within the filter’s callback.
Otherwise we need to handle all possible input cases, for get_avatar( $some_input )
, as it supports:
- user id,
- user email,
- gravatar md5 hash,
WP_User
object,WP_Post
objectWP_Comment
object.
We can look into the get_avatar_data()
function, to get an idea how to write such checks.
An alternative, to determine the user id from the get_avatar()
input, we might try to fetch the md5 hash from the generated gravatar url and use it to determine the user id from it. Maybe store the md5 email hash for each user.
The found_avatar
argument might also help, as it’s true if the avatar was found for the given user.
Hope it helps!
Related Posts:
- How to allow an user role to create a new user under a role which lower than his level only?
- Display user registration date
- Whats the best way to share user data across multiple WordPress websites?
- WordPress auto login after registration not working
- What the user_status column?
- Problem with Hebrew characters in username
- Remove email verification when new user register
- How to change user`s avatar?
- How to set up User email verification after Signup?
- How to let user set password on registration
- How to display custom user meta from registration in backend?
- Multi-steps WordPress registration : in 4 steps how to?
- Force users to complete their profile after they register? How to
- Upload gravatar in WP profile?
- How do i auto approve new user?
- Copy a user from one WordPress site to another
- Can I hook into the invite user process to verify their email address is from a certain domain?
- How to get user ID during registration and add it to a custom table
- Get user info outside WordPress
- Limit content by user registration date
- What is the best way to avoid spammers registering to my blog?
- ACF Upload Image in front-end with custom form
- How to customize wp_signon()
- How Do I Prevent Junk Account Creation?
- Can I bulk register contributors for a new blog
- New user notification doesn’t include activation link
- Changing default Buddypress avatar affects all site avatars (because gravatar)
- WordPress to use Drupal users’ credentials
- Create not-activated user in code, wordpress
- Front End Registration Form Code – Password Field Not Saving
- How can I verify users facebook ID that he provides during signup process
- Plugin for limiting user registration based on ip with expiry period?
- Restricted registrations or removing the ability to edit your password/email
- Creating user in Firebase after WordPress user registration
- Can user login details be used for other applications?
- Users managed to register on website with no register button?
- Add value in user table when user is created
- Displaying different in-page content to cliente/admin
- Should I encrypt the response that triggers an Ajax action? Is nonce sufficient?
- Can i add password field into my wp registration form?
- wordpress disable login for unverified user
- How can I attach a user to another user with user meta
- Register user when after filling contact form
- Creating user without username and password
- WordPress registration without wp-login.php and wp-admin folder, is it possible?
- How to change user`s avatar?
- Check for valid email after user inactivity?
- Assign random (and unique) user meta upon registration
- How to add registration date and last login date to user list page
- What is correct way to change user’s email?
- Send clear password via mail
- How to programmatically read the plan text password when user register?
- Custom registration and pending approval
- Automatic Website user password generation
- Customising “user ids” and add to ‘user’ panel in the admin area
- How to hide some users to unlogged users [closed]
- How to make current user’s avatar + display name link to their profile?
- Unique password to access a section site
- Give users alternative/second avatar that is rectangle sized
- Make new users automatically approved
- Adding more fields to the add user page on dashboard
- Edit text of WordPress “Register” button
- User with same Mail but a different additional info(like domain)
- set automatically email address for WordPress users
- WordPress 5.8 – Hide or Remove personal fields from admin Profile page
- Can I add a unique code for each user based on the location?
- Perform multiple actions after wp_insert_user()
- Send user auto generated password on different email
- How can i display pagination in custom comment list?
- Safely changing UserID’s, re-using deleted UserID’s and automatically using deleted userID’s instead of an increment
- Single Sign On (SSO) between two WordPress websites
- Auto approve new users if their username is included in a predefined list
- Disable emails for new user registration
- Insert user register into my own user table instead of wp own user
- What is the best user experience for user to perform an action using email?
- Custom registration fields not appearing in user info
- How to restrict Admin from creating new users from Add new user screen in dashboard to only of one domain?
- Registration page as homepage
- New User ID not working in custom function with user_register hook
- Set user role on registration so can upload file to own media library area
- Disallow user registration/checkout via Hotmail/Yahoo
- Retrieve New user’s ID
- Let admin users edit member profiles from front end
- view and update form only for registered users
- Integrating Facebook Registration (and Login) on a WordPress page
- New User Registration email
- how can i inform other users about new user registration? [closed]
- Add custom input field in new user page
- MySQL query to list users who never signed in
- Wordpres password as plain text in email
- WordPress password as plain text in email
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- Return ID of authors who have at least one post
- How can I allow users to sign up but prevent them from accessing the WordPress backend?
- Failed login attempts
- call wp_insert_user in custom class doesnt work
- User(s) already exists show error please provide a valid username
- define two login page url
- Shopping plugin with user groups [closed]
- Set a minimal number for next user_id