Support » Theme: TextBook » Comment Form Modifications

  • Resolved myeternaltrails

    (@myeternaltrails)


    Hi Textbook Community,

    I am trying to Make only NAME field Mandatory in my comment section of the posts. And somehow I managed to do that by adding following piece of code in my functions.php file

    function require_comment_name($fields) {
    if ($fields['comment_author'] == '')
    wp_die('Error: please enter a valid name.');
    return $fields;
    }
    add_filter('preprocess_comment', 'require_comment_name');

    But there are two problems which I am not able to resolve :-

    1- The Validation Result is shown after Posting the comment. While I want it to happen in such a way that I should not be able to Post comment without filling the NAME field (similar to COMMENT text area)
    2- I should be able to show “Required” Text in the Name Field Area.

    Any help in this will be much appreciated !

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • supernovia

    (@supernovia)

    Hi @myeternaltrails, did you make any progress on this? I understand you want to make the name, but not the email address, required?

    I wanted to note that the comment form is standard through WordPress. If you make changes via a plugin or functionality snippet rather than through your theme, the changes can persist even if you use a different theme.

    Noting as well, if you do choose to modify the theme, be sure to use a child theme rather than editing your theme directly.

    Hi @supernovia, No I couldn’t proceed further on this problem.

    Yes, I am doing these changes using a Child Theme, but problem is, these modifications are not giving the results which I actually want.

    Also, with reference to make these changes via a plugin or functionality snippet, do you have any clue on this which can solve my problem ?

    Gemma Evans

    (@gemmaevans)

    Hi @myeternaltrails,

    do you have any clue on this which can solve my problem ?

    I’m unable to say which whether a custom function or plugin will be the better option is this will very much depend on the site setup and your level of coding knowledge.

    If the function above isn’t working, you may want to contact a developer for help — they should be able to take a closer look at what is happening. Jetpack.pro is a great place to look for developers if you don’t already know someone.

    myeternaltrails

    (@myeternaltrails)

    Hi @gemmaevans ,

    Thanks for your suggestion. I’ll surely do that.

    Gemma Evans

    (@gemmaevans)

    You’re very welcome, best of luck 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Comment Form Modifications’ is closed to new replies.