- Posts: 20
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?
- Bostjan Cadej
- Topic Author
- Offline
- Junior Member
Less
More
8 years 5 months ago - 8 years 5 months ago #153422
by Bostjan Cadej
Disabling email field as a required field for comments? was created by Bostjan Cadej
I have a K2 v2.7.0 site 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!
Last edit: 8 years 5 months ago by Bostjan Cadej.
Please Log in or Create an account to join the conversation.
- JoomlaWorks Support Team
- Offline
- Elite Member
Less
More
- Posts: 169
8 years 5 months ago - 8 years 5 months ago #153439
by JoomlaWorks Support Team
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks Support Team on topic Disabling email field as a required field for comments?
Hi,
The validation of the email is located at the components/com_k2/models/item.php
and
Have in mind that you will hack the core by doing this.
The validation of the email is located at the components/com_k2/models/item.php
if (empty($userName) || $userName == JText::_('K2_ENTER_YOUR_NAME') || empty($commentText) || $commentText == JText::_('K2_ENTER_YOUR_MESSAGE_HERE') || empty($commentEmail) || $commentEmail == JText::_('K2_ENTER_YOUR_EMAIL_ADDRESS'))
{
$response->message = JText::_('K2_YOU_NEED_TO_FILL_IN_ALL_REQUIRED_FIELDS');
$response->cssClass = 'k2FormLogError';
echo $json->encode($response);
$mainframe->close();
}
and
if (!JMailHelper::isEmailAddress($commentEmail))
{
$response->message = JText::_('K2_INVALID_EMAIL_ADDRESS');
$response->cssClass = 'k2FormLogError';
echo $json->encode($response);
$mainframe->close();
}
Have in mind that you will hack the core by doing this.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 8 years 5 months ago by JoomlaWorks Support Team.
Please Log in or Create an account to join the conversation.
- Bostjan Cadej
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 20
8 years 5 months ago #153472
by Bostjan Cadej
Replied by Bostjan Cadej on topic Disabling email field as a required field for comments?
Hi Teo,
I'm not looking for validation, I'm looking for field being required or not - obligatory or not.
Where can I set that (for email filed in this form)?
I'm not looking for validation, I'm looking for field being required or not - obligatory or not.
Where can I set that (for email filed in this form)?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 5 months ago #153486
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Disabling email field as a required field for comments?
Validation is what you are looking for.
Since the field is required, a validation script will always run.
By removing the code Teo mentioned, the email field will not be required as it is by default.
Since the field is required, a validation script will always run.
By removing the code Teo mentioned, the email field will not be required as it is by default.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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?