- This topic has 14 replies, 3 voices, and was last updated 7 years, 8 months ago by
Tom.
-
AuthorPosts
-
July 17, 2018 at 10:29 pm #626258
DWCore
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:6jdCIt would be great if someone could help me quickly.
Thank you very much.
best regards
Werner
July 18, 2018 at 9:06 am #626734Leo
StaffCustomer SupportHi there,
Does this happen to new posts you created after the setting has been changed?
July 18, 2018 at 10:35 am #626806DWCore
Hello
Since I had the setting already during the installation, this occurs with all posts. Where could the problem be?
July 18, 2018 at 11:11 am #626829Leo
StaffCustomer SupportHey 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.
July 18, 2018 at 11:38 am #626850DWCore
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.
July 18, 2018 at 12:26 pm #626895Leo
StaffCustomer SupportAhh sorry I misunderstood you before.
I believe that is a bug on our end indeed.
I’ll confirm with Tom ๐
Thanks!
July 18, 2018 at 12:38 pm #626912DWCore
No problem :-). Please let me know if you have a solution.
See you later and thanks for the help.July 18, 2018 at 7:57 pm #627113Tom
Lead DeveloperLead DeveloperThat 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 ๐
July 19, 2018 at 1:19 am #627238DWCore
Thank you for your proposal for a temporary solution
Unfortunately, it does something I do not want.
See for yourself:Previous situation:
See screenshot hereYour solution suggestion: (Removes everything)
See screenshot hereDesired solution: Simply without the stars behind it ๐
See screenshot hereCan you please help me to remove only the three fields Name, Email and URL. Many Thanks
July 19, 2018 at 8:55 am #627604Tom
Lead DeveloperLead DeveloperMy mistake! Can you try the updated code?: https://generatepress.com/forums/topic/wp-set-for-anonymous-comments-but-the-mandatory-asterisks-are-displayed/#post-627113
July 19, 2018 at 9:33 am #627642DWCore
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
July 19, 2018 at 9:47 am #627658DWCore
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.
July 19, 2018 at 7:51 pm #627989Tom
Lead DeveloperLead DeveloperIn 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 );July 19, 2018 at 11:09 pm #628077DWCore
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.
WernerJuly 20, 2018 at 7:47 am #628335Tom
Lead DeveloperLead DeveloperYou’re welcome! ๐
-
AuthorPosts
- You must be logged in to reply to this topic.