Note that there are some explanatory texts on larger screens.

plurals
  1. PODrupal vote_up_down module reporting incorrect points
    text
    copied!<p>I am working on a project using Drupal 6 (6.11 at the moment, haven't yet upgraded to 6.12) and part of the core functionality is the ability to vote on nodes. I'm having some rather weird behaviour that has taken me an age to track down and now I have, I still can't fix it.</p> <p>This is what I've managed to figure out so far:</p> <ul> <li>The template file <code>sites/default/modules/vote_up_down/theme/vote_up_down_points.tpl.php</code> automatically calls the function <code>template_preprocess_vote_up_down_points()</code> from <code>vote_up_down.module</code>.</li> <li><code>vote_up_down.module</code> then queries the database using the values stored in the <code>$variables</code> array that is passed to it</li> <li>On only <em>one</em> of the 3 occasions this is called on a typical node (in this case forum posts) <code>$variables</code> doesn't have a value for <code>$variables['cid']</code>.</li> <li>That one occasion is when it reads the score so as to display it below the post itself. And, instead of locating the current post's score, it locates the <em>first-ever-voted-on</em> post's score. (This is because instead of returning the score of one post, it returns the score of all posts and then uses the first one from the list).</li> </ul> <p>I am assuming that <code>$variables</code> is a system-wide constant (looking at the content of it using <code>print_r</code> seems to confirm that) and so perhaps this is a core bug as it should always be the same. I checked the contents of <code>$variables</code> and the only 4 parts of around 50 that are different in the one that doesn't work are: cid - blank, tag - blank (although this is discovered by the function and correctly substituted as 'vote'), zebra - even &amp; id - 2. I imagine the last 2 are not really important for this, so the key must be in why <code>$variables['cid']</code> is not being passed through.</p> <p>So, my questions are: </p> <ul> <li>Has anyone had this problem before and how did you fix it?</li> <li>If not, do you have any tips as to how I can figure out why this is not working correctly?</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload