Keyword

Disabling email field as a required field for comments?

More
13 years 6 months ago #95172 by A. B.
I have a K2 powered blog with comments enabled for everyone.  When the users leave comments they are required to enter their name and email and optionally url.  I want to make the email field also optional (not required).  How can I do that?

 

Thanks!

Please Log in or Create an account to join the conversation.

More
13 years 6 months ago #95173 by A. B.
I'm still trying to figure this out. If anyone has ideas, please let me know

Please Log in or Create an account to join the conversation.

More
13 years 6 months ago #95174 by william white
Try editing item_comments_form.php in anoverride and comment out line 27 and 28 in k2 2.4.1

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #95175 by juaardhi
Yes you can. But before you make any

changes, make sure that you backup your original file in case you want to change it back later. Inside the folder path: /components/com_k2/models/item.php,
Line 705, search for: You need to fill in all Required Fields!
You will find:
if ( empty($userName) || $userName==JText::_( 'enter your name...' ) || empty($commentText) || $commentText==JText::_( 'enter your comment here...' ) || empty($commentEmail) || $commentEmail==JText::_( 'enter your e-mail address...' ))

{
echo JText::_('You need to fill in all required fields!');
$mainframe->close();
}

Then remove this line: || empty($commentEmail) || $commentEmail==JText::_( 'enter your e-mail address...' )
After that, removed the next command line below it, (Line 709 to line 712):

if (!JMailHelper::isEmailAddress($commentEmail)) {
echo JText::_('Invalid e-mail address!');
$mainframe->close();
}

 

And then click save.
With this, you can still post a comment to your blog with or with out inserting your email.
Here is the modified file that I upload along this post. (*See attachment)
Upload and change the name back to item.php

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum