Let’s add two additional fields in the form of comments: Town (City) and AcceptTerms (I agree with the rules). the user will need to check.
Adding new fields to the table jos_jcomments
| Code: |
|
|
| Code: |
|
|
Jcomments.class.php open the file and add the data fields in the class JCommentsDB, for example after the following lines:
| Code: |
|
|
we would get like this:
| Code: |
|
|
Open the file jcomments.ajax.php and after the lines:
| Code: |
|
|
add 2 more:
| Code: |
|
|
Open the file / tpl / default / tpl_form.php and before the lines:
| Code: |
|
|
We add our new fields:
| Code: |
|
<p><input type= “checkbox” name= “acceptterms” value= “1” id= “comments-form-acceptterms” /> |
Open the file jcomments.php, we find in it the line:
| Code: |
|
|
and replace it with:
| Code: |
|
|
This way, we add a sample of information on these fields from the database.
Now open the template file: / tpl / default / tpl_comment.php and admit after lines:
| Code: |
|
|
add the the following:
| Code: |
|
|
You are now done go and see if it works.
Note if it does not work first time round check all your code again step by step check for spaces that should not be there ect
After this add the field to the admin list:
Open admin.jcomments.html.php
Find this lines
<?php
if ($row->email != ”) {
?>
<tr valign=”top” align=”left”>
<td><?php echo JText::_(‘A_COMMENT_EMAIL’); ?></td>
<td><input type=”text” size=”35″ name=”email” value=”<?php echo $row->email; ?>” /></td>
</tr>
and add this lines before them:
<tr valign=”top” align=”left”>
<td><?php echo JText::_(‘A_COMMENT_TELEPHONE’); ?></td>
<td><input type=”text” size=”35″ name=”email” value=”<?php echo $row->telephone; ?>” /></td>
</tr>
That’s it.
The original post is from:
http://www.joomlapro.co.uk/forum/components/add-and-extra-field-to-jcomments.html
Thank you for your great tutor, but I still have some problem in jcomment.
how to add a phone field in jcomment but the phone number doesn’t pos in the comment place (only admin can see the phone number from backend area), could you tell me how?
Thank you
add field in joomla?
————————–
http://a-00.ru/@.php
very helpfull
Howdy just wanted to give you a brief heads up and let you know a few of the pictures aren’t loading properly.
I’m not sure why but I think its a linking issue.
I’ve tried it in two different web browsers and both show the
same results.