4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: FreDyz on June 10, 2003, 02:10:13 AM
-
The vote and comment system of 4images is good, but I would prefer other system, I try to explain my ideas:
I would like a form to vote and comment simultaneously (you write your comment and rate the image and then click on send button to send all data).
Then my comment and my vote are listed together (my vote no longer would be anonymous).
P.E.:
----------------
FreDyz - 5 points
Hey your photo is really nice!!
----------------
JhonDoe - 1 point
I don't like this photo...
----------------
=====================
It would be very difficult?
-
well no and i think v@no did something like that.
-
well no and i think v@no did something like that.
where can I find it? I've searched in the forum but I haven't found anything about this
-
I am searching same MOD on the forum but i can't find it too... Can someone help please???
-
I can make a MOD like this, but i won't do it for free since i have no use for it on my site. If you're interested PM me ;)
-
details.php
search for:
if ($comment_text == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['comment_required'];
$error = 1;
}
replace with:
if ($comment_text == "") {
$msg .= (($msg != "") ? "<br />" : "").$lang['comment_required'];
$error = 1;
}
if (!$error) {
$rating = intval($HTTP_POST_VARS['rating']);
if ($rating != "" && $id) {
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_rated = isset($HTTP_COOKIE_VARS[$cookie_name.'rated']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'rated'])) : array();
if ($rating && $rating <= MAX_RATING && $id) {
if (!isset($session_info['rated_imgs'])) {
$session_info['rated_imgs'] = $site_sess->get_session_var("rated_imgs");
}
$split_list = array();
if (!empty($session_info['rated_imgs'])) {
$split_list = explode(" ", $session_info['rated_imgs']);
}
if (!in_array($id, $split_list) && !in_array($id, $cookie_rated)) {
$session_info['rated_imgs'] .= " ".$id;
$session_info['rated_imgs'] = trim($session_info['rated_imgs']);
$site_sess->set_session_var("rated_imgs", $session_info['rated_imgs']);
$cookie_rated[] = $id;
$cookie_expire = time() + 60 * 60 * 24 * 4;
setcookie($cookie_name.'rated', serialize($cookie_rated), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
update_image_rating($id, $rating);
$msg = $lang['voting_success'];
}
else {
$msg = $lang['already_voted'];
$vote_error = 1;
}
}
else {
$msg = $lang['voting_error'];
$vote_error = 1;
}
}
if ($rating != "" && $vote_error != 1) {
$comment_headline = $comment_headline." ".$lang['user_rating'].$rating;
}
}
lang/XXXX/main.php
add:
$lang['user_rating'] = " | Vote: ";
(the text you will find in the comment_headline - for example "This ist the Headline | Vote: 5")
templates/XXXXX/comment_form.html
search for:
<tr>
<td width="90" valign="top"> </td>
<td>{bbcode}</td>
</tr>
repleace with:
<tr>
<td width="90" valign="top"> </td>
<td>{bbcode}</td>
</tr>
<tr>
<td width="90" valign="top"> </td>
<td><select name="rating" class="select">
<option value="">--</option>
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
<option value="1">1</option>
</select>
<input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" /></td>
</tr>
templates/XXXXX/details.html
delete:
{if rate_form}
<div align="center">{rate_form}</div>
{endif rate_form}
Only quick and dirty but one hour hard work...
For donations via Paypal use spende@owl-techno.de.... *g*
-
xxx
-
$sql = "SELECT user_id, image_id, vote
FROM ".IMAGES_TABLE."
WHERE image_id = ".$id." AND user_id = ".$user_info['user_id'];
$rated = $site_db->query_firstrow($sql);
$rating = ($rated['vote']) ? $rated['vote'] : $rating;
Do you save the voting in the image table? :?
-
$sql = "SELECT user_id, image_id, vote
FROM ".IMAGES_TABLE."
WHERE image_id = ".$id." AND user_id = ".$user_info['user_id'];
$rated = $site_db->query_firstrow($sql);
$rating = ($rated['vote']) ? $rated['vote'] : $rating;
Do you save the voting in the image table? :?
yes, its saved in image table in field image_votes because I dont have any voted table in my db and I dont think so if somebody has this table on new instaled gallery.
I'm tryng change vote in sql query to image_votes but nothing happend vote : 5 doesnt show.
-
Test it now...
On my Demo Site it works:
http://fw-shop.flash-webdesign.de/details.php?image_id=50
-
Test it now...
On my Demo Site it works:
http://fw-shop.flash-webdesign.de/details.php?image_id=50
now works great, thanks acidgod