Author Topic: [MOD] Votes saved in DB  (Read 245168 times)

0 Members and 1 Guest are viewing this topic.

Offline luktur

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #165 on: January 21, 2009, 11:26:51 AM »
This mod is fantastic Thx for it.

It's working very good.

It's posiible to have data and hour of voting on photo?

http://ogk.cal.pl/details.php?image_id=684

After my nick.

Offline mstgokcen

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #166 on: March 17, 2009, 02:02:48 PM »
is it possible to delete my vote and re-vote? Or change the vote? But aain everyone must give vote for once not more then once

Offline luktur

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #167 on: May 08, 2009, 04:15:13 PM »
Hello.

How can I prevent from users that are voting from own photo?

Offline luener

  • Jr. Member
  • **
  • Posts: 54
  • Pessimisten sind Optimisten mit mehr Erfahrung!
    • View Profile
    • TopFoto24.com
Re: [MOD] Votes saved in DB
« Reply #168 on: November 02, 2009, 04:40:59 PM »
Thx for this Mod,
it works great on my Site. :D

Ralf

Offline alekseyn1

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • My Project
Re: [MOD] Votes saved in DB
« Reply #169 on: December 26, 2009, 01:34:17 PM »
guys, anyone knows how to join this MOD and this MOD http://www.4homepages.de/forum/index.php?topic=4023.0?

I run a website where people comment, but are not  very keen in setting a rating....

so I would really appreciate any help in joining of this MOD with this MOD http://www.4homepages.de/forum/index.php?topic=4023.0

but i need that MOD to let visitors post comment ONLY with voting and vote without comment


EDIT
Nevermind...
« Last Edit: December 26, 2009, 09:19:23 PM by alekseyn1 »

Offline alekseyn1

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • My Project
Re: [MOD] Votes saved in DB
« Reply #170 on: December 27, 2009, 10:27:09 PM »
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  :lol:

2. in comments_form.html

add in the place where you would like this form to appear...

Code: [Select]
  <!--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:

Code: [Select]
if ($user_name == "")  {
and ADD BEFORE

Code: [Select]
//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

Code: [Select]
update_comment_count($id, $user_info['user_id']);
and ADD AFTER

Code: [Select]
//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

Code: [Select]
//-----------------------------------------------------
//--- Image Details -----------------------------------
//-----------------------------------------------------

and add after

Code: [Select]
$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...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Votes saved in DB
« Reply #171 on: December 27, 2009, 10:58:04 PM »
Not quiet sure what exactly is the problem...it's not clear...also your tutorial is a mix of several other mods you've installed and would not work for everyone else, unfortunately.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline alekseyn1

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • My Project
Re: [MOD] Votes saved in DB
« Reply #172 on: December 27, 2009, 11:13:23 PM »
well... trouble is, that when the comment is posted, the rating value is transfered with POST... database updates..

but the data for the rate form (not the one listed by me, but the one modded with the modification listed in this topic to show the user vote after he voted) does not get pulled from the database correctly...

EDIT

fixed by replacing in page_header.php

line

Code: [Select]
if ($action == "rateimage" && $id) {
with line
Code: [Select]
if ($action == "rateimage" && $id || $action == "postcomment" && $id) {
« Last Edit: December 28, 2009, 10:00:15 AM by alekseyn1 »

Offline Joss

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • All about digital photography
Re: [MOD] Votes saved in DB
« Reply #173 on: February 06, 2010, 02:00:32 AM »
Hey guys

I already installed the [MOD] Votes saved in DB. I use Option A. I use a table called "voted" to store the image_id, the user_id, vote, and user_IP. The problem is when I delete an image or an entire category, it's ok. 4images delete the records in the images table, but doesn't delete the record in the voted table. How can we repair this?

I agree with it. For now I've deleted more than 25000 rows from 4images_voted table via phpMyAdmin:

Code: [Select]
DELETE
FROM `4images_voted`
WHERE NOT EXISTS
( SELECT *
FROM `4images_images`
WHERE 4images_images.image_id = 4images_voted.image_id
);

DELETE
FROM `4images_voted`
WHERE NOT EXISTS
( SELECT *
FROM `4images_users`
WHERE 4images_users.user_id = 4images_voted.user_id
);

But we need a correction on core delete (image/user) function.
Digital Photo Gallery: http://gallery.imagemaster.ru

Offline luktur

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #174 on: February 27, 2010, 11:43:09 PM »
This mod is super. But is it possible that users can't see who voted on photo? Now they can only see who voted but they can't see the point's.
I want that only admin know who voted on picture.

Offline Joss

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • All about digital photography
Re: [MOD] Votes saved in DB
« Reply #175 on: April 14, 2010, 08:12:41 PM »
I want that only admin know who voted on picture.

Open details.php, find
Code: [Select]
//--- Voted stats -------------------------------------
and before

Code: [Select]
$site_template->register_vars(array(
insert something like (change YOURNAME to your login)

if ($user_info['user_name'] !="YOURNAME") {
    $voted_list = "Image was rated";
}
Digital Photo Gallery: http://gallery.imagemaster.ru

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Votes saved in DB
« Reply #176 on: April 15, 2010, 04:00:56 AM »
This mod is super. But is it possible that users can't see who voted on photo? Now they can only see who voted but they can't see the point's.
I want that only admin know who voted on picture.
What mod/code are you referring to?

@Joss:
better use if ($user_info['user_level'] == ADMIN)
{
  
// your code here
}

;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline luktur

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #177 on: May 03, 2010, 08:31:47 PM »

@Joss:
better use if ($user_info['user_level'] == ADMIN)
{
  
// your code here
}

;)
[/quote]

When a putt Your code it's not working :/ I still see nick as quest or normal user.


if ($user_info['user_name'] !="YOURNAME") {
    
$voted_list "Image was rated";
}


Code above is working but how add more admins?

Offline luktur

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #178 on: February 04, 2011, 07:05:05 PM »
Is this possible?:

Create new category (photo of the month). I put for example 10 photos and user vote for it. But - on gallery a have voting scale 1-10.

Is this possible to do for this category:
- only one point - user can give only 1 (in other categories all the time 1-10)
- hide for user info about voting - only admins can see it. (now user can see in bellow thumbnail)

Offline Artemios

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: [MOD] Votes saved in DB
« Reply #179 on: March 05, 2011, 01:26:05 PM »
Ich benutze [MOD] Votes saved in DB in der Version B.

Erstmal ein Dank an V@no. Es funktioniert ausgezeichnet. Es gibt keine Probleme.

Nun möchte ich verhindern, dass User ihre eigenen Bilder bewerten können.

Dafür habe ich ein Mod von 2006 gefunden, dass die functions.php ändert.

User darf sein eigenes Bild nicht bewerten:
http://www.4homepages.de/forum/index.php?topic=489.msg2197#msg2197

Ich weiß nun nicht, ob sich diese beiden Mods vertragen.
Oder gibt es eine andere Möglichkeit, das [MOD] Votes saved in DB Version B, so anzupassen, dass eigene Bilder nicht bewertet werden können?


Nachtrag: ich habe es einfach ausprobiert und es klappt dann nicht mehr. Zwar können die eigenen Bilder nicht mehr bewertet werden, aber die Datenbank funktioniert nicht mehr.
Mit dem Ergebnis, dass jetzt wieder mehrfache Bewertungen aller anderen Bilder möglich sind.

Daher noch einmal die Frage, ob es eine anderes Mod gibt, dass man einsetzen könnte und das sich mit "Votes saved in DB in der Version B" verträgt?

Wäre schön, wenn sich mal jemand äußern könnte.

Gruß
Artemios


« Last Edit: March 20, 2011, 12:15:15 AM by Artemios »