Hi,
Now, before I run off into a long blurb about how to do this, I'm sure I remember something about some Extra Fields functions that appeared not long ago in 4images, but I don't remember anything about them offhand. I expect they will do what you need, without having to masacre files like I'm about to tell you to do
NOTE: Be sure to take a full backup of any changed files, as what I've written below is just off the top of my head, and I havn't tested it.
(In this example, I'm going to assume that you want the extra field to hold a website URL)
Open up the file comment_form.html in your templates directory, and add the html for the extra field in there. Call it something like "{lang_comment_website}" and "frm_comment_website" or something. Also, edit comment_bit.html and add in the extra field here as well.
Next, edit your language files, and add a new entry for "{lang_comment_website}", eg, "$lang['comment_website']="Website URL"" (or whatever you want the extra field to be.)
Next, open up details.php, and browse down to the line that reads ...
$comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));
Duplicate this line, but change the details to match your new field, eg
$comment_website = un_htmlspecialchars(trim($HTTP_POST_VARS['frm_comment_website']));
If you wish to check that the field has something useful in it, add a block in the "if (xxx == "")..etc" section a few lines down.
Change the line ...
$sql = "INSERT INTO ".COMMENTS_TABLE." (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date) VALUES $id, ".$user_info 'user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
To read ...
$sql = "INSERT INTO ".COMMENTS_TABLE." (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date, comment_website) VALUES $id, ".$user_info 'user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().", '$comment_website')";
Next, (still in details.php) move down to the Show Comments section.
Look for any SQL SELECT statements in this block of code, and tack your "comment_website" bit on in the appropriate places.
Next, look for the block that starts
$site_template->register_vars(array(
On the bottom of the list of template vars, add something like...
"lang_comment_website" => $lang['comment_website'],
"frm_comment_website" => $comment_row[$i]['comment_website']
Remember to add a comma to the line above these 2 (if it doesn't have one), and you may wish to use the format_text() functions as well.
Once you've done all this, you'll need to edit the comments table in the database itself, and add the new field. Use something like...
ALTER TABLE comments ADD comment_website varchar(100) DEFAULT NULL;
I know I've missed stuff above, and I honestly doubt that the code above will work out of the box, so don't just go cutting and pasting it all over the place
, but it's a starting block for you to build on
As I mentioned at the begining of this post, I'm sure Jan introduced somehting that was supposed to make this sort of thing easier, but I can't remember the details off-hand.
Good luck with it.
Thanks,
Alan.