First off, great module.

I get the following error message when I try to create a view with sort criteria "Drupalit: Total Votes":

user warning: Unknown table 'drupalit_votes' in order clause query: SELECT DISTINCT(node.nid) FROM node node LEFT JOIN og_ancestry og_ancestry ON node.nid = og_ancestry.nid WHERE (node.type IN ('storylink')) AND (og_ancestry.group_nid = 1464) ORDER BY drupalit_votes.votes DESC LIMIT 0, 10 in /home/colossal/public_html/includes/database.mysql.inc on line 172.

Any ideas of what the problem could be?

Here is the view export code:

$view = new stdClass();
$view->name = 'test_stories';
$view->description = 'Lists the top stories for a particular group.';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = 'There are no stories for this group.';
$view->page_empty_format = '1';
$view->page_type = 'teaser';
$view->url = 'test-stories/$arg';
$view->use_pager = TRUE;
$view->nodes_per_page = '10';
$view->sort = array (
array (
'tablename' => 'drupalit_votes',
'field' => 'votes',
'sortorder' => 'DESC',
'options' => '',
),
);
$view->argument = array (
array (
'type' => 'gid',
'argdefault' => '1',
'title' => '',
'options' => '',
'wildcard' => '',
'wildcard_substitution' => '',
),
);
$view->field = array (
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'storylink',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(drupalit_votes, node);
$views[$view->name] = $view;

Comments

tic2000’s picture

From the sql the error is obvious, it doesn't join the drupalit_votes table, but why it doesn't I really don't know. This is my first try with views, so maybe I missed something. But the fact is that from your export code I see clear that

array (
'tablename' => 'drupalit_votes',
'field' => 'votes',
'sortorder' => 'DESC',
'options' => '',
),
);

and
$view->requires = array(drupalit_votes, node);
so I really can't see the problem.
From my experience when testing the module, maybe is a cache problem. Try to empty the cache_views table and see if that fixes the error. I have to investigate on this one.

finkster’s picture

Thanks tic. I tried clearing the cache, but that didn't work. I've done some more testing, and it has something to do with using "Teaser List" as the view type. When I try "List View" as the view type, and add the field "Drupalit: Total Votes", it doesn't give an error, but it only lists the vote values. I need it to return the teaser for the node, so I have to use "Teaser List." I'm not sure if the problem is with Druplalit, or is a problem inherent to Views. I'll keep exploring on my end and I'll let you know if I find a solution. Thanks.

tic2000’s picture

Your problem should be fixed if you choose the "Drupalit: Has drupalit votes" filtre. This if you keep using the beta3 version. But better try the latest version and let me know if it fixes the problem.

finkster’s picture

Yup, that did the trick! Thanks for all of your help, tic, I appreciate it!

tic2000’s picture

Status: Active » Closed (fixed)

OK, then issue closed