• jeeltcraft

    (@jeeltcraft)


    Hi I’d like to use your plugin to replace defauld user avatars with a custom field which is already uploaded in a user meta field.

    Would it work changin the function “wp_user_avatars_avatar_defaults” on your funtions.php file?
    As an example,

    if avatar’s user has role “employer” I want the avatar to display the field “company_logo” (which is an url to a given file)
    if avatar’s user has role “candidate” I want the avatar to display the field “candidate_photo” (which is an url to a given file)

    Do you this this may be possible changing the code on that function?

    Thanks for your plugin,

    Reguards,
    LauraC

Viewing 2 replies - 1 through 2 (of 2 total)
  • Funny enough I was looking at this for support a client requested on using a file upload field in WP Job Manager to set the avatar (my plugin is WP Job Manager Field Editor).

    My plugin already has the feature/ability built-in to configure a meta key to save the value to under the user’s meta, but after looking at their code base … it looks like the value saved to user meta is stored as a serialized array, and not just a URL to an image (which would be needed).

    Also, with the new version of WP Job Manager, the company_logo field is actually set as the post thumbnail now, and not actually saved to the listing meta anyway … so that’s something to keep in mind as well.

    So technically when you said “with a custom field which is already uploaded in a user meta” … unless you’re using my plugin to save it automatically, or you have added custom code to do it … those fields are not saved to a user’s meta, but to the listing itself (besides the company_logo as mentioned above which is featured image)

    If you are using my plugin, I wrote this code below that you can add to your site to set the avatar based on the key you set to save it as under the user’s meta (not sure if it’s compatible with this plugin or not):
    https://gist.github.com/tripflex/3190b9b3b484f99c0a4ba4f6c59cb44f

    Thread Starter jeeltcraft

    (@jeeltcraft)

    At the moment I use your plugin to save the url to the user meta table and then change the user avatar on that user meta key, the code is mostly similar to yours, but I use the main avatar wordpress filter hook to set the avatar for all the web page:

    https://wordpress.stackexchange.com/questions/7620/how-to-change-users-avatar/247637#247637

    Your plugin was very helpful for setting the user meta and retrieve the search terms for each user, the now have customized matches on my website showing on their dashboard.
    Thanks a lot for that.

    • This reply was modified 7 years, 11 months ago by jeeltcraft.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘custom avatar on user meta field’ is closed to new replies.