Closed (fixed)
Project:
Vote Up/Down
Version:
4.7.x-1.0
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 Feb 2007 at 13:44 UTC
Updated:
14 Jan 2009 at 17:06 UTC
Hi,
I have a problem with vote up down on a certain site. I can,t vote on nodes on the teaser mode, for example on taxonomy pages or on views listings for example.
Here is the related template.php code that I use.
function _phptemplate_variables($hook, $vars) {
static $is_forum;
$variables = array();
if (!isset($is_forum)) {
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == '') {
$nid = arg(1);
}
if (arg(0) == 'comment' && arg(1) == 'reply' && is_numeric(arg(2))) {
$nid = arg(2);
}
if ($nid) {
$node = node_load(array('nid' => $nid));
}
$is_forum = ($node && $node->type == 'forum');
_is_forum($is_forum);
}
if ($is_forum) {
switch ($hook) {
case 'comment' :
$variables['template_file'] = 'node-forum';
$variables['row_class'] = _row_class();
$variables['name'] = $vars['author'];
$variables['userid'] = $vars['comment']->uid;
$joined = module_invoke('flatforum', 'get_created', $vars['comment']->uid);
$variables['joined'] = $joined ? format_date($joined, 'custom', 'Y-m-d') : '';
$posts = module_invoke('flatforum', 'get', $vars['comment']->uid);
$variables['posts'] = $posts ? $posts : 0;
$variables['submitted'] = format_date($vars['comment']->timestamp);
$subject = $vars['comment']->subject;
$variables['title'] = empty($subject) ? ' ' : $subject;
$variables['content'] = $vars['comment']->comment;
$variables['links'] = empty($vars['links']) ? ' ' : $vars['links'];
break;
case 'node' :
$variables['row_class'] = _row_class();
$variables['userid']=$vars['node']->uid;
$joined = module_invoke('flatforum', 'get_created', $vars['node']->uid);
$variables['joined'] = $joined ? format_date($joined, 'custom', 'Y-m-d') : '';
$posts = module_invoke('flatforum', 'get', $vars['node']->uid);
$variables['posts'] = $posts ? $posts : 0;
$variables['title'] = empty($vars['title']) ? ' ' : $vars['title'];
$variables['content'] = $vars['node']->body;
$variables['links'] = empty($vars['links']) ? ' ' : $vars['links'];
$vars['storylink_url'] = check_url($vars['node']->vote_storylink_url);
if (arg(1) != 'add' && arg(2) != 'edit') {
$style = variable_get('vote_up_down_widget_style_node', 0) == 1 ? '_alt' : '';
$vars['vote_up_down_widget'] = theme("vote_up_down_widget$style", $vars['node']->nid, 'node');
$vars['vote_up_down_points'] = theme("vote_up_down_points$style", $vars['node']->nid, 'node');
}
$vars['vote_storylink_via'] = theme('vote_storylink_via', $vars['node']->vote_storylink_url);
if (arg(1) == 'top') {
static $count;
$count = is_array($count) ? $count : array();
$count[$hook] = is_int($count[$hook]) ? $count[$hook] : 1;
$vars['seqid'] = $count[$hook]++;
}
break;
}
}
return $variables;
}
function _row_class() {
static $forum_row = TRUE;
$forum_row = !$forum_row;
return $forum_row ? 'odd' : 'even';
}
function _is_forum($arg = NULL) {
static $is_forum = FALSE;
if ($arg) {
$is_forum = $arg;
}
return $is_forum;
}
Do you see any reason why the widget does not work on teasers?? The teaser actually show on the page, but it does not work. It only works on the node page itself.
Any ideas on what to do please?
Thanks
Comments
Comment #1
patchak commentedAfter a few more tests, I can confirm that there seems to be a problem with the module. I can,t seem to be able to vote on teasers that are on views pages or on taxonomy pages.
I can vote on the node itself, so the widget seems to work.
Also, I can see the widget on node teasers, but for some strange reason I can,t vote when the node is in teaser mode and displayed in a view..
Any ideas what,s going on?
Thanks
Comment #2
patchak commentedIt's really weird. Voting works on the full node page, but not on the teasers... Something tells me this has to do with the template.php I use...
Frjo, would you mind having a look at that template.php file I posted, and tell me if yu see any obvious reason the teaser vote would not work, but the full page yes??
Thanks
Comment #3
frjo commentedI can take a look at your template.php. Where is it?
Comment #4
patchak commentedHi frjo,
Here is the full version of my template.php file....
As you can see it's a mix of flatforum and vote up down, for the variables or something like that...
Find anything that could cause the ajax voting not to pass? Please not that I actually don't use the storylink.module itself, but I activated the voting on other nodes.
thanks for your help!
Patchak
Comment #5
patchak commentedHi Frjo,
S do you have any idea what's causing this behaviour?? COuld it be the theme, anywhere than in template.php?
Do you have any ideas where else to look about this issue?
Thanks,
Patchak
Comment #6
patchak commentedFrjo,
Any idea about why the vote does not work on the teasers! I swear I tried to figure it out.. but no luck , voting only works on the full page view...
Strange!
Comment #7
frjo commentedPost the relevant HTML from a page where you can't vote.
Comment #8
patchak commentedHi Frjo,
here is the head from a normal page where the vote does not work at all in teaser mode...
And here is the relevant html for the teasers and the widget...
here is the relevant html for a node in full view... where the voting works...
I hope this can help to finally figure out what the problem is, it,s very weird as right when the user goes to a full node view, the voting works..
Do you need any more info?? Please let me know!
Patchak
Comment #9
frjo commentedThe HTML looks OK.
If you turn of JavaScript does the voting works then?
If you turn of all none voting contrib modules does voting work then?
Comment #10
alexandreracine commentedThis will auto-close if no feedback for two weeks.
Comment #11
lut4rp commented