- Posts: 2
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Disabling email field as a required field for comments?
Disabling email field as a required field for comments?
- A. B.
-
Topic Author
- Offline
- New Member
Less
More
14 years 1 month ago #95172
by A. B.
Disabling email field as a required field for comments? was created 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!
Thanks!
Please Log in or Create an account to join the conversation.
- A. B.
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 2
14 years 1 month ago #95173
by A. B.
Replied by A. B. on topic Disabling email field as a required field for comments?
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.
- william white
-
- Offline
- Platinum Member
Less
More
- Posts: 3722
14 years 1 month ago #95174
by william white
Replied by william white on topic Disabling email field as a required field for comments?
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.
- juaardhi
-
- Offline
- New Member
Less
More
- Posts: 1
13 years 11 months ago #95175
by juaardhi
Replied by juaardhi on topic Disabling email field as a required field for comments?
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
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.
- Forum
- K2 Community Forum
- English K2 Community
- Disabling email field as a required field for comments?