Hello,
I am developing a really cool Karma module (if I say so! :-D ).
I am having a bit of a problem with a (hopefully minor) issue.
I would like to show a page with the top ranking users. So, I have:
$items[] = array(
'path' => 'karma_users',
'title' => t('Users by karma'),
'description' => t('Users by karma'),
'callback' => 'simple_karma_view_users',
'access' => user_access('view users by karma'),
'type' => MENU_NORMAL_ITEM)
And then a simple:
function simple_karma_view_users(){
$result=pager_query(
db_rewrite_sql('SELECT recipient_uid,sum(karma) as k from {simple_karma} WHERE '.simple_karma_sql_duration('created') .' AND recipient_uid <> 0 GROUP BY recipient_uid ORDER BY k DESC')
, 100 );
$data_row=array();
while ($data = db_fetch_object($result)) {
#drupal_set_message("R: ".$data->recipient_uid);
#drupal_set_message("K: ".$data->k);
$data_row[]= array(
theme('username', user_load(array('uid' => $data->recipient_uid ))),
$data->k
);
}
return "".theme_table(array(), $data_row, array(), NULL).theme('pager', NULL, 10, 0);
NOW, what I want to do is give the ability to filter by date. So, the user can select a FROM and a TO date.