• [Mod] Rating Button Disabled After Vote 5 0 5 1
Currently:  

Author Topic: [Mod] Rating Button Disabled After Vote  (Read 64115 times)

0 Members and 1 Guest are viewing this topic.

Offline fgabriel

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: [Mod] Rating Button Disabled After Vote
« Reply #30 on: January 19, 2007, 09:36:08 PM »
Hi,

I got the same error as fgabriel does when I call "New images" link   (http://www.xx.com/search.php?search_new_images=1).

Code: [Select]
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rate_suffix in /mnt/107/sdc/a/1/x/includes/functions.php on line 446
Notice: Undefined variable: rating in /mnt/107/sdc/a/1/x/includes/functions.php on line 446

This "functions.php" line 445/446 :

 
Code: [Select]
if (check_permission("auth_vote", $image_row['cat_id'])) {
    $rate_form = rate_form($image_row['image_id'], $rate_suffix, $rating);

Anybody helps please? thanks


im not alone,
i think nobody wants to help orb42  :(

orb42

  • Guest
Re: [Mod] Rating Button Disabled After Vote
« Reply #31 on: January 22, 2007, 07:58:49 AM »
For this mod, I really don't understand the way the code was insered in "functions.php".

The code insertion proposed is an aberation because it introduces in a function some variables that are not previously defined in the page.

I would like to know what's thinking about the mod's author..

Offline urmasmuld

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: [Mod] Rating Button Disabled After Vote
« Reply #32 on: February 19, 2007, 12:04:36 PM »
I've same problem =(

Notice: Undefined variable: rate_suffix in /www/01/xxx/xxx/xxx/functions.php on line 449

Notice: Undefined variable: rating in /www/01/xxx/xxx/xxx/functions.php on line 449
 
 

Offline MacroWorld

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [Mod] Rating Button Disabled After Vote - Bug Fixed
« Reply #33 on: April 30, 2007, 11:35:26 AM »
Open includes/functions.php

Find:
Code: [Select]
if (check_permission("auth_vote", $image_row['cat_id'])) {
Insert Above:
Code: [Select]
  $rate_suffix = "";
  $rating = "";

Find Next:
Code: [Select]
$site_template->register_vars(array(
          "rate" => ($no_rateform && !(check_permission("auth_vote", $image_row['cat_id']) && $no_rateform)) ?  "rated" : $lang['rate'],
          "rate_options" => $rate_options,
          "rate_button" => ($no_rateform) ? $no_rateform : ""

    ));

Insert Above
Code: [Select]
$image_row = 0;
everything will be OK  :D

Offline winracer

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Help Me With Perl
Re: [Mod] Rating Button Disabled After Vote
« Reply #34 on: November 18, 2009, 07:15:57 PM »
my page_header.php looks like this because of other mods.

I would like to have greyed out after user votes and do not want to remmeber the users computer just the username. can this be done using both mods?


Code: [Select]
//-----------------------------------------------------
//--- Save Rating -------------------------------------
//-----------------------------------------------------
if ($action == "rateimage" && $id) {
  $rating = intval($HTTP_POST_VARS['rating']);

  if ($user_info['user_level'] != GUEST) {
    $sql = "SELECT user_id, image_id, vote
            FROM ".VOTED_TABLE."
            WHERE image_id = ".$id." AND user_id = ".$user_info['user_id'];
    $rated = $site_db->query_firstrow($sql);
    $rating = ($rated['vote']) ? $rated['vote'] : $rating;
  }else{
    $rated = FALSE;
  }
  $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) && !$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'];
    }
  }
  else {
    $msg = $lang['voting_error'];
  }
}

winracer

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] Rating Button Disabled After Vote
« Reply #35 on: November 19, 2009, 02:13:28 AM »
Sorry, I'm not sure what exactly is your question about...
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 winracer

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Help Me With Perl
Re: [Mod] Rating Button Disabled After Vote
« Reply #36 on: November 19, 2009, 02:24:13 PM »
Sorry, I'm not sure what exactly is your question about...

never mind, I changed my mind and installing the star mod. sorry
winracer

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [Mod] Rating Button Disabled After Vote
« Reply #37 on: November 23, 2010, 09:53:44 PM »
Hi,

is there an easy way to check before the tag {rate_form} is displayed to check
the user has allready voted before he tries to vote again?

Out of the box he can try it again and the {msg} tag is filled with the you have
allready voted message.

Why the check is not made before a revote try?

Something like: {ifnot user_voted}{rate_form}{endifnot user_voted}


Greetz X23

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

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] Rating Button Disabled After Vote
« Reply #38 on: November 24, 2010, 12:10:59 AM »
Your question is not clear. The point of this mod is to disable the rate button after the user's vote...
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 x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [Mod] Rating Button Disabled After Vote
« Reply #39 on: November 24, 2010, 12:16:32 AM »
Your question is not clear. The point of this mod is to disable the rate button after the user's vote...

Hi,

you're right but im searching for the right change that makes it possible that the rate_form is
only displayed if the user not allready voted for that image, for example (i wish) with a tag like
{ifnot user_voted}...

Should i start a new thread?


Greetz X23

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

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] Rating Button Disabled After Vote
« Reply #40 on: November 24, 2010, 02:31:20 AM »
I see now.
Use {ifno rate_button} ..
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 SweD

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [Mod] Rating Button Disabled After Vote
« Reply #41 on: November 02, 2011, 11:06:41 AM »
Great! Work! I liked it!

Demo: http://www.all-live.ru/