[Support request] A few questions regarding comments

Home Forums Support [Support request] A few questions regarding comments

Home Forums Support A few questions regarding comments

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #1137100
    Max

    Hi there!

    I am using the latest GP Premium. I searched the forum but could not find a satisfying answer to my questions.

    There are three issues:

    1.) I tested the “comment tree” functionality and noticed that once you have one comment and a reply to that comment, the reply gets deleted as well once the original comment has been deleted. That is really impractical of course. Do you know whether this is a bug? Instead of deleting the whole tree there should simply be a message stating something like “The original comment of this thread does no longer exist.” After deleting the original comment the reply is still visible in the backend though.

    2.) Under “Settings” and “discussion” you can set the requirements for a user being able to post a comment. However, even if I untick the box “Comment author must fill out name and email”, those two fields still contain a “*” which indicates to the user that they would still need to fill in those fields. Do you know how this can be corrected? (The box is currently unticked so neither name nor E-Mail are required.)

    3.) If the “Comment author must fill out name and email” box has been ticked but the according requirements have not been met a new page with an error message opens once the user clicks on “Post Comment”. This is an O.K. solution but still a bit unintuitive when it comes to usability. Would it be possible to simply mark the fields with the missing information (Name, E-Mail) with a colour, e.g. red? That would be a smoother approach.

    If those issues are too large to be solved in a single topic I will open a new one. However, I figured since they are somewhat related it might be easier to solve them in one.

    Thanks a lot in advance for your help and best wishes

    #1137229
    Leo
    Staff
    Customer Support

    Hi there,

    1) WordPress itself handles the comment system and I don’t believe this is a bug. Worth mentioning it to their support though and see if they have a solution for this, if not it can definitely be a suggestion to them.

    2) Can you give this a shot?
    https://docs.generatepress.com/article/remove-e-mail-and-url-field-from-comment-form/

    3) Unfortunately this would be the same as #1. GP simply calls WordPress’ comment system so the exact same thing would happen in a twenty series WP theme.

    Let me know if this helps at all 🙂

    #1138113
    Max

    Hi Leo,

    Thanks for the quick reply!

    1.) + 3.): Ok, I will give it a try and post my findings here.

    2.) As far as I can see this removes the fields completely. I want them to remain there (in case someone wants to send their E-Mail-address) but without the star “*” – so basically I want to change the text which is still being displayed incorrectly.
    Basically I found an answer here:
    https://de.wordpress.org/support/topic/diskussionen-auf-den-webseiten/
    It is in German but the code is universal of course:

    $comments_args = array(
            // Change the title of send button 
            'label_submit' => __( 'Send', 'textdomain' ),
            // Change the title of the reply section
            'title_reply' => __( 'Write a Reply or Comment', 'textdomain' ),
            // Remove "Text or HTML to be displayed after the set of comment fields".
            'comment_notes_after' => '',
            // Redefine your own textarea (the comment body).
            'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><br /><textarea id="comment" name="comment" aria-required="true"></textarea></p>',
    );
    comment_form( $comments_args );

    I also found this code which might be even better:

    // comment form fields re-defined:
    add_filter( 'comment_form_default_fields', 'mo_comment_fields_custom_html' );
    function mo_comment_fields_custom_html( $fields ) {
    	// first unset the existing fields:
    	unset( $fields['comment'] );
    	unset( $fields['author'] );
    	unset( $fields['email'] );
    	unset( $fields['url'] );
    	// then re-define them as needed:
    	$fields = [
    		'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'A CUSTOM COMMENT LABEL', 'noun', 'textdomain' ) . '</label> ' .
    			'<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" aria-required="true" required="required"></textarea></p>',
    		'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'A CUSTOM NAME LABEL', 'textdomain'  ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    			'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $aria_req . $html_req . ' /></p>',
    		'email'  => '<p class="comment-form-email"><label for="email">' . __( 'A CUSTOM EMAIL LABEL', 'textdomain'  ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    			'<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $aria_req . $html_req  . ' /></p>',
    		'url'    => '<p class="comment-form-url"><label for="url">' . __( 'A CUSTOM WEBSITE LABEL', 'textdomain'  ) . '</label> ' .
    			'<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>',
    	];
    	// done customizing, now return the fields:
    	return $fields;
    }
    // remove default comment form so it won't appear twice
    add_filter( 'comment_form_defaults', 'mo_remove_default_comment_field', 10, 1 ); 
    function mo_remove_default_comment_field( $defaults ) { if ( isset( $defaults[ 'comment_field' ] ) ) { $defaults[ 'comment_field' ] = ''; } return $defaults; }

    Could you help me implement it via php Snippets for GP, so could you basically tell me which part I would have to use to alter the text for the E-Mail and Name fields?

    #1138181
    Leo
    Staff
    Customer Support

    The capitalized text in the second snippet should be what you are looking for. For example: A CUSTOM COMMENT LABEL

    #1138218
    Max

    I removed the “comment_field” section since I want this to stay the same and altered the labels but nothing changed:

    This is the code I used:

    add_filter( 'comment_form_default_fields', 'mo_comment_fields_custom_html' );
    function mo_comment_fields_custom_html( $fields ) {
    	// first unset the existing fields:
    	unset( $fields['author'] );
    	unset( $fields['email'] );
    	unset( $fields['url'] );
    	// then re-define them as needed:
    	$fields = [
    		'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name or user name', 'textdomain'  ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    			'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $aria_req . $html_req . ' /></p>',
    		'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Your E-Mail address', 'textdomain'  ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    			'<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $aria_req . $html_req  . ' /></p>',
    		'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Your website', 'textdomain'  ) . '</label> ' .
    			'<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>',
    	];
    	// done customizing, now return the fields:
    	return $fields;
    }
    // remove default comment form so it won't appear twice
    add_filter( 'comment_form_defaults', 'mo_remove_default_comment_field', 10, 1 ); 
    function mo_remove_default_comment_field( $defaults ) { if ( isset( $defaults[ 'comment_field' ] ) ) { $defaults[ 'comment_field' ] = ''; } return $defaults; }
    #1138241
    Leo
    Staff
    Customer Support

    Are you able to check with WordPress’ support on this as well?

    Unfortunately I’m really not sure if there is away to keep the field without making them required.

    If they can provide a method that works for a twenty series theme, it would work the same for GP.

    It might be worth asking on https://stackoverflow.com/ as well.

    #1138346
    Max

    I will and update this post accordingly.

    #1138377
    Leo
    Staff
    Customer Support

    Thanks 🙂

    #1160701
    Max

    So I wrote WP support and.. did not get very far as the dev/moderator over there was not willing to get into the issue.
    Regarding the issue that “Parent comments (threaded) get deleted” I did the whole troubleshooting part althought that did not solve anything. Frankly speaking, the answers (not all questions were answered) seemed like a standard copy+paste answer: https://wordpress.org/support/topic/parent-comments-get-deleted/#post-12399008
    I will update to the next WP version manually the next time an update is announced but without so much as an explanation I will simply not make the effort right now.

    The rest of the issues remained unanswered, or rather: They wanted me to ask you guys again and did not get back to me ever since: https://wordpress.org/support/topic/changing-placeholders-of-comment-section-and-more/#post-12399019

    The first issue is more important than the second “batch” of issues so I hope at a certain point there will be a solution. Perhaps I will also ask at stackoverflow.

    #1160791
    Leo
    Staff
    Customer Support

    When they ask what theme you are using, just say you are using twenty twenty 🙂

    #1160804
    Max

    I mentioned it in the thread – let us see whether they will reply.

    #1160873
    Leo
    Staff
    Customer Support

    Probably best to just start a new topic here:
    https://wordpress.org/support/theme/twentytwenty/

    #1160908
    Max

    Well this is the response I received:

    You’re using a commercial theme. For commercial product support please contact the author directly on their site. In order to be good stewards of the WordPress community, and encourage innovation and progress, we feel it’s important to direct people to those official locations.

    https://generatepress.com/

    Forum volunteers are also not given access to commercial products, so they would not know why your commercial theme or plugin is not working properly. This is one other reason why volunteers forward you to the commercial product’s vendors. The vendors are responsible for supporting their commercial product.

    As the author is aware, commercial products are not supported in these forums.

    So now I am in a bit of a pickle no? According to the moderator gp is not “covered” and I guess, even if I “pretended” to be using the twentytwenty theme it would quickly be uncovered that it is not quite so. Perhaps it is just this specific moderator since they offered a solution in this thread (apparently that does not work for me) no questions asked.

    #1160911
    Leo
    Staff
    Customer Support

    What if you just start a topic in the twenty twenty theme forum I linked above and don’t give them the link to your site?

    If they ask for a link, just start a staging site with the twenty twenty theme 😉

    #1163785
    Max

    Hm I might try that. Just to clarify: With “staging site” you mean a new wordpress installation using the twenty twenty theme right? Or is there a way to “stage” a site with another theme this way? I am asking because at the moment I am not sure whether my external hosting service allows for multiple wordpress installations.

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.