• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Author box : Display Avatar for users without user email

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › General Genesis Framework Discussions › Author box : Display Avatar for users without user email

This topic is: not resolved

Tagged: archive author, avatar, genesis_author_box, get_avatar, gravatar, pre_get_avatar

  • This topic has 10 replies, 6 voices, and was last updated 10 months, 3 weeks ago by andyatsato.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • January 19, 2022 at 8:36 am #504666
    marcsaffar
    Participant

    Hello,
    I build a website using latest genesis-sample.
    There will be some posts from authors I won't know their email address.

    So I used this snippet to create accounts without email :

    // This will suppress empty email errors when submitting the user form
    add_action('user_profile_update_errors', 'my_user_profile_update_errors', 10, 3 );
    function my_user_profile_update_errors($errors, $update, $user) {
    $errors->remove('empty_email');
    }
    
    // This will remove javascript required validation for email input
    // It will also remove the '(required)' text in the label
    // Works for new user, user profile and edit user forms
    add_action('user_new_form', 'my_user_new_form', 10, 1);
    add_action('show_user_profile', 'my_user_new_form', 10, 1);
    add_action('edit_user_profile', 'my_user_new_form', 10, 1);
    function my_user_new_form($form_type) {
    ?>
    <script type="text/javascript">
    jQuery('#email').closest('tr').removeClass('form-required').find('.description').remove();
    // Uncheck send new user email option by default
    <?php if (isset($form_type) && $form_type === 'add-new-user') : ?>
    jQuery('#send_user_notification').removeAttr('checked');
    <?php endif; ?>
    </script>
    <?php
    }

    Then I used this plugin to set an avatar from image in the wp media library :
    Simple Local Avatars

    Then I choosed the checkbox to get the author box displayed in the author/user archive page.

    It works well for an author with an email, I get profile and author box image from local media library but for a user without email I get the local image for the profile but default mystery grey gravatar image still shows instead of local image.

    Any idea to help ?
    Best

    January 30, 2022 at 11:05 pm #504681
    Brad Dalton
    Participant

    Why not use the contributor role so email addresses are mandatory before submitting posts and then use Simple Local Avatars


    Tutorials for StudioPress Themes.

    January 31, 2022 at 9:16 am #504683
    marcsaffar
    Participant

    Hello Brad,
    Thank you for your answer.

    The problem is I will receive some texts from authors I won't know their emails and it will be long and difficult to get these email adresses.

    Finally I found this in Genesis > structure > post.php
    $gravatar = get_avatar( get_the_author_meta( 'email', $user_id ), $gravatar_size );

    When I change 'email' by 'ID' it works how I want for every users even without email.

    I'd preferred that function would be filterable. Now I have to pay attention in case of future Genesis upgrade.

    February 10, 2022 at 4:49 am #504707
    NeelyStark
    Participant

    The Information you shared above is great. I have been reading all you shared here. In this you explained everything very well. If i want any further guideline we will contact you here https://studiopress.community/topic/author-box-display-avatar-for-users-without-user-email-results/

    February 10, 2022 at 5:00 am #504711
    Brad Dalton
    Participant

    @marcsaffar It is filterable using the genesis_author_box filter.

    Sorry. not getting replies when i subscribe to existing topics.


    Tutorials for StudioPress Themes.

    February 10, 2022 at 6:47 am #504713
    Brad Dalton
    Participant

    And, you can also filter get_avatar and use the pre_get_avatar filter.


    Tutorials for StudioPress Themes.

    February 10, 2022 at 7:21 am #504714
    Brad Dalton
    Participant

    And, you can also use add_filter( 'avatar_defaults' to add a default image.


    Tutorials for StudioPress Themes.

    February 23, 2022 at 11:25 am #504752
    marcsaffar
    Participant

    Sorry. not getting replies when i subscribe to existing topics.

    Me neither, they should fix it 😉 anyway thanks for your answers.

    And, you can also filter get_avatar and use the pre_get_avatar filter.

    I tried but unsuccessfully. Maybe I did note do correctly do the add_filter…
    .

    And, you can also use add_filter( 'avatar_defaults' to add a default image.

    Thanks but I don't want a default image 😉

    April 20, 2022 at 2:13 am #505061
    stevesmith761
    Participant

    To find the best printer for cardstock, we researched 30 machines from our list of the best printers to identify the ones that were the ablest to handle thicker media and a wide range of paper finishes. Printers needed to be able to handle a minimum of 60 lb weighted paper and have good enough ink quality to absorb quickly into cardstock finishes without smudging. Below is a list of the best printers after our research.

    May 6, 2022 at 12:28 am #505202
    gomtithaparhospitals
    Participant

    I want To create a new avatar for a health related website, provide IVF Treatment in Moga Is there any suggestions for this website related avatar.

    May 7, 2022 at 4:12 am #505207
    andyatsato
    Participant

    Hi, you can install a gravatar plugin to solve the problem.


    Sato.org is a great coupon code finder.

  • Author
    Posts
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.
Log In

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble