-
AuthorPosts
-
November 15, 2011 at 11:55 pm #170737
Does anyone know how to disable the “email required” field in the front end of JA Comment?
jooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
November 25, 2011 at 11:40 am #426377Hi
May i know which Joomla! / JA Comment version you are using ? I don’t demo code installed in my local for checking. So i need to know this information :).Btw, without email enter should be make you trouble with spamming . Are you sure about this ?
Thank you,
Viet VuDecember 14, 2011 at 3:30 pm #429627Hello guys,
I have this problem too. I want to completely disable the email field, so it isn’t even displayed in the frontend.
I have JA Comment version 1.1.0.Thanks
jooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
December 14, 2011 at 3:32 pm #429628Hi
Just for a trick.
In case you don’t want to ask your commenter enter email. You can set in code random email value . and set this email field be display:none.
Yup !December 14, 2011 at 3:35 pm #429629Hi,
Thanks for the reply! I figured I’d do something like that.
Personally, I didn’t want to edit the code because then
updates are released and changes are overridden and its a big mess.When I code a solution, I’ll post.
jooservices Friendjooservices
- Join date:
- October 2014
- Posts:
- 8556
- Downloads:
- 0
- Uploads:
- 130
- Thanked:
- 1245 times in 1121 posts
December 14, 2011 at 3:38 pm #429630YOu don’t need to hack core
#1. Code your own plugin
#2. template overridesThank you
December 14, 2011 at 4:45 pm #429641hi jooservices,
I was wondering if you could help me with something else. I’m trying to add another email variable to the email templates.
I want to make the id of the comment available. I’m developing a quick moderation from the email, and I want to send the
ID as part of a link which can be clicked to publish, mark as spam, or delete.
Do you have any idea of where I can find the file that defines the email variables?December 15, 2011 at 4:07 pm #429776Hello,
To anyone else who wants to disable the email field, I have a solution.
It’s not clean, but it’s pretty simple and it works.
What you do is hide the email field and label, and then append a permanent email so that a value is still submitted.Firstly, go to the file components/com_jacomment/themes/default/html/comments/addnew.php
At around line 100, you’ll see the following code:
<!-- BEGIN TEXT EMAIL-->
<span class="jac-form-guest">
<?php //if you want set text of name in field email, you must set class jac-inner-text for input id guestemail and add same text in hidden's id jac_hid_text_email?>
<label for="guestEmail"><?php echo JText::_("TEXT_EMAIL");?> <span id="required_2" class="required"><?php echo JText::_("TEXT_REQUIRED");?></span></label>
<input type="hidden" value="<?php echo JText::_("TEXT_EMAIL");?>" id="jac_hid_text_email">
<input id="guestEmail" value="<?php //echo JText::_("TEXT_EMAIL");?>" name="email" type="text" class="field text inputbox <?php //jac-inner-text?>" value="" size="18" tabindex="3" title="<?php echo JText::_("NOT_DISPLAYED_PUBLICLY");?>"/>
<div id="err_guestEmail" style="color: red;"></div>
</span>
<!-- END TEXT EMAIL-->
Change that to this:
<!-- BEGIN TEXT EMAIL-->
<span class="jac-form-guest">
<?php //if you want set text of name in field email, you must set class jac-inner-text for input id guestemail and add same text in hidden's id jac_hid_text_email?>
<input type="hidden" value="<?php echo JText::_("TEXT_EMAIL");?>" id="jac_hid_text_email">
<input id="guestEmail" value="testemail@testemail.com" name="email" type="hidden" class="field text inputbox <?php //jac-inner-text?>" value="" size="18" tabindex="3" title="<?php echo JText::_("NOT_DISPLAYED_PUBLICLY");?>"/>
<div id="err_guestEmail" style="color: red;"></div>
</span>
<!-- END TEXT EMAIL-->Notice the testemail@testemail.com. That is the value that is permanently set as the email. Each comment that will be sent will have this value for the email. At this point, the email field has dissappeared, but your not done yet. There is a javascript file that automatically resets the value above. It is located here: components/com_jacomment/asset/js/ja.comment.js .
I’m not sure specifically which line needs to be changed here. I simply went through the whole file, and found every instance of guestEmail, and whenever a value was set, I changed it to testemail@testemail.com For example, on line 40:
if($(this).attr('id') == "guestEmail" && $(this).val() == $("#jac_hid_text_email").val())
$(this).val("testemail@testemail.com");and again on line 1271
if($('guestEmail') != undefined){$("guestEmail").value = "testemail@testemail.com";}
There are many other points throughout the file where this should be changed. Like I said, I didn’t bother finding which one.
I don’t guarantee this solution. I know comments are submitted correctly, and appear correctly. I am still not sure if there are other associated bugs. Technically, there should not be, because an email value is submitted to the database. I welcome anyone who has a better solution, because i recognize this one is a bit rough. -
AuthorPosts
This topic contains 8 replies, has 3 voices, and was last updated by tom123 13 years ago.
We moved to new unified forum. Please post all new support queries in our New Forum