[Resolved] WP set for anonymous comments, but the mandatory asterisks are displayed

Home Forums Support [Resolved] WP set for anonymous comments, but the mandatory asterisks are displayed

Home Forums Support WP set for anonymous comments, but the mandatory asterisks are displayed

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #626258
    Werner

    Hello
    Unfortunately, my English is only rudimentary, so I had to use the Google translator, but I hope that my problem will be understood anyway.

    I have under Settings -> discussion at the item “More comment settings” the check mark removed at “users must comment to name and e-mail address specify”, so that visitors can comment anonymously.

    Unfortunately, despite this setting, the fields Name and Email are still the mandatory asterisks.

    What am I doing wrong or how can I solve it?

    My website is not yet officially online and password protected, but you can log in as follows:

    Username: Monika_Peichl
    Password: EfCoFJw:6jdC

    It would be great if someone could help me quickly.

    Thank you very much.

    best regards

    Werner

    GeneratePress 2.1.3
    GP Premium 1.6.2
    #626734
    Leo
    Staff
    Customer Support

    Hi there,

    Does this happen to new posts you created after the setting has been changed?

    #626806
    Werner

    Hello

    Since I had the setting already during the installation, this occurs with all posts. Where could the problem be?

    #626829
    Leo
    Staff
    Customer Support

    Hey I was able to duplicate this on my end as well.

    However it’s the same when I try it with a default WordPress Twenty Seventeen theme.

    Can you give that a test as well?

    If that’s the case then you might need to bring it up to WordPress support:
    https://wordpress.org/support/

    Let me know if this helps.

    #626850
    Werner

    Hello and thank you for your quick reply.

    When I activate the Twenty Seventeen theme it works (no stars to see). As soon as I switch back to GP, the asterisks are back.

    Although I can comment anonymously, but the visitor does not know, because he sees the asterisks.

    #626895
    Leo
    Staff
    Customer Support

    Ahh sorry I misunderstood you before.

    I believe that is a bug on our end indeed.

    I’ll confirm with Tom πŸ™‚

    Thanks!

    #626912
    Werner

    No problem :-). Please let me know if you have a solution.
    See you later and thanks for the help.

    #627113
    Tom
    Lead Developer
    Lead Developer

    That is indeed a bug.

    For now, you can do this:

    add_filter( 'comment_form_default_fields', function( $fields ) {
        $commenter = wp_get_current_commenter();
        $fields['author'] = '<label for="author" class="screen-reader-text">' . esc_html__( 'Name', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Name', 'generatepress' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" />';
        $fields['email'] = '<label for="email" class="screen-reader-text">' . esc_html__( 'Email', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Email', 'generatepress' ) . '" id="email" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" />';
    
        return $fields;
    }, 20 );

    Let me know πŸ™‚

    #627238
    Werner

    Thank you for your proposal for a temporary solution

    Unfortunately, it does something I do not want.
    See for yourself:

    Previous situation:
    See screenshot here

    Your solution suggestion: (Removes everything)
    See screenshot here

    Desired solution: Simply without the stars behind it πŸ™‚
    See screenshot here

    Can you please help me to remove only the three fields Name, Email and URL. Many Thanks

    #627604
    Tom
    Lead Developer
    Lead Developer
    #627642
    Werner

    Many Thanks. Works great.

    So it just has “return $fields;” Missed πŸ™‚

    I guess that this will generally be fixed at the next update.

    Thanks again for your support.

    Lovely wishes

    Werner

    #627658
    Werner

    One more question.

    I wanted to remove the URL field with the following code in the function.php. But what it does is that it removes it below the email field, just to put it back in front of the send button.

    // URL-Feld entfernen
    /*--------------------------------------------------------*/
    function remove_url_field($fields) {
      if (isset( $fields['url'])) {
        unset($fields['url']);
        }
        return $fields;
    }
    add_filter('comment_form_default_fields', 'remove_url_field');

    Can you tell me if this is the case with you or if it is not ok with the code?

    Many Thanks.

    #627989
    Tom
    Lead Developer
    Lead Developer

    In that case, this should be your full code:

    add_filter( 'comment_form_default_fields', function( $fields ) {
        $commenter = wp_get_current_commenter();
        $fields['author'] = '<label for="author" class="screen-reader-text">' . esc_html__( 'Name', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Name', 'generatepress' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" />';
        $fields['email'] = '<label for="email" class="screen-reader-text">' . esc_html__( 'Email', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Email', 'generatepress' ) . '" id="email" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" />';
    
        unset( $fields['url'] );
    
        return $fields;
    }, 20 );
    #628077
    Werner

    Hello Tom,

    oh dear, sometimes it can be so easy. One simple line more πŸ™‚
    I could have come up with that myself.

    It works great.

    Thank you very much.
    Werner

    #628335
    Tom
    Lead Developer
    Lead Developer
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.