Suppressing the mandatory email field
When submitting a comment, the email field is mandatory (this is set at the program level and cannot be changed). However, it is possible to workaround this required field in the case where you want a visitor to post a comment without providing their email address. You can do this by creating a layout override for this the comments module.
The directory default_template refers to the template that is set as the default for your site. Please replace this name with the actual name of the template directory.
To create the layout override for the comment form, find the file:
/modules/mod_comments_comment/tmpl/form.php
Copy this to:
/templates/default_template/html/mod_comments_comment/form.php
In the new file, find the lines that look similar to the following:
<?php if (!$user->get('id')) : ?>
<dt><label for="comment_email"><?php echo JText::_('Comments_Email');?></label></dt>
<dd><input id="comment_email" name="email" class="inputbox required validate-email" tabindex="2" /></dd>
<?php endif; ?>
Change these lines to the following:
<?php if (!$user->get('id')) : ?>
<input type="hidden" name="email" value="
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
" />
<?php endif; ?>
This sets the email to a fixed value for anonymous visitors but it will still record the email for a user that is logged in.
No problem, support subscriptions give you access to one-on-one help from real Joomla experts.