WordPress.org

Ready to get started?Download WordPress

Forums

Name Required in Comments? (5 posts)

  1. Anonymous
    Unregistered
    Posted 9 years ago #

    Hello Everyone. I was wondering if I could set wordpress up to require a name field when replying to a post. I know there is an option to have name AND email address, but I only wish to have name. Is that possible?
    Thanks in advance.
    Regards ~ Neczy

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Think it is, but I've not done it.
    It would need the editing of 'wp-comments-post.php' and the removal (probably) of lines 22,23,24, then taking the email bit out of line 38.

  3. Anonymous
    Unregistered
    Posted 9 years ago #

    Ah yes, that did it. I removed lines 22, 23, 24 and then on line 38 changed it too:
    if ( get_settings('require_name_email') && ('' == $author || '' == $author) )
    I'm not sure if thats totally "proper" but it worked! Thanks podz, you are very helpful on the forums!

  4. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Wow - it worked !! Excellent :)

  5. thejoker101
    Member
    Posted 9 years ago #

    If you do that though, won't you not be able to keep the email if someone does enter one, why don't you just do something like this:

    if ($author == '')
    die( __('Error: please fill the required fields (name).') );

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.