OK guys... I solved it...
Here is what you do if you want to have a comment ONLY if your user rated an image... and the user can VOTE with no comments for the image...
1. Install this MOD
2. in comments_form.html
add in the place where you would like this form to appear...
<!--new rate system -->
{if rate_form}
<tr>
<td>
{rate}
</td>
<td valign="bottom">
<select name="rating" class="select" {rate_button}>
{rate_options}
</select>
<input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" />
</td>
</tr>
{endif rate_form}
<!-- end of new rate system -->
3. in details.php
find:
if ($user_name == "") {
and ADD BEFORE
//no comment without rating
//user rated before?
$image_rated_by_user = "";
$sql = "SELECT vote
FROM ".VOTED_TABLE."
WHERE image_id =".$id." AND user_id =".$user_info['user_id'];
$row = $site_db->query_firstrow($sql);
$image_rated_by_user = (isset($row['vote']))? 1 : 0 ;
//user is the owner of image?
$is_image_owner2 = "";
$sql2 = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = ".$id." AND i.image_active = 1 AND c.cat_id = i.cat_id";
$image_row2 = $site_db->query_firstrow($sql2);
$is_image_owner2 = ($user_info['user_id'] == $image_row2['user_id']) ? 1 : 0;
if (!$is_image_owner2 && $image_rated_by_user == 0 && $rating == "--") {
$msg .= (($msg != "") ? "<br />" : "").$lang['rating_required'];
$error = 1;
}
//end no comment without rating
3.1
find
update_comment_count($id, $user_info['user_id']);
and ADD AFTER
//save rating from comment form
if (!$is_image_owner2 && $image_rated_by_user == 0) {
update_image_rating($id, $rating);
}
//end save rating from comment form
4. in your language main.php
find
//-----------------------------------------------------
//--- Image Details -----------------------------------
//-----------------------------------------------------
and add after
$lang['rating_required'] = "You did not include the rating for this image";
this should work for you...
I can not remove one bug....
I have not removed the original rate form from below the image, so that user can vote as before and that rate form works perfectly... and shows the rating you have gived to the image....
but if you add a rating from the comments form, it gets entered into the database and the comment appears.. but the rate form does not change... thus letting the user vote again from the separate rate form...
anyways any ideas please.. I ran out of steam today trying to resolve this one...