Closed (duplicate)
Project:
Signup
Version:
5.x-2.4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Jul 2008 at 22:50 UTC
Updated:
3 Oct 2009 at 03:38 UTC
Add this to the $tables['signup'] array inside of the signup_views.inc file
'signup_total' => array(
'name' => t('Signup: Node: Signup Total'),
'handler' => 'views_handler_field_signup_total',
'notafield' => TRUE,
'sortable' => FALSE,
'help' => t('Number of users who have signed up.'),
), And the handler function you need to add is this
/**
* Displays a field with the total of signups for this node.
*/
function views_handler_field_signup_total($fieldinfo, $fielddata, $value, $data) {
return db_result(db_query("SELECT COUNT(*) FROM {signup_log} WHERE nid = %d", $data->nid));
}
cheers,
Katrina
Comments
Comment #1
ambereyes commentedAlso, in order to see this field in Views, you will need to empty the cache after adding this code to the file. I use the developer module for this, makes it very easy.
Comment #2
dwwThanks, but please search for existing issues first. ;)
#179585: Signup count field in Views 7.x
Comment #3
socialnicheguru commentedsubscribing
Comment #4
kassissieh commentedI updated this for Drupal 6. I'm not sure whether modifying Signup is the best way to do this, or this could be better accomplished at the theme layer. I'd appreciate your advice/code on this. This code outputs x / y, where x is the # of users signed up for a node and y is the signup limit for the node.
Create file signup_handler_field_signups_total.inc
In file signup_views.inc, add this to the array in function signup_views_handlers:
... and add this to the signup log array:
Comment #5
daniel sanchez commentedI'm trying this on Drupal 6 and am getting the error:
Error: handler for signup_log > signup_total doesn't exist!
What folder is signup_handler_field_signups_total.inc supposed to be in?
Comment #6
kardave commentedsubscribing....
(Events, Views, Signup, Drupal 6.x)
Comment #7
ryan88 commentedI am having the same problem. I installed the code as directed, and it appears to work, I can see the field in views, but when I add it, I get the error in views, "Error: handler for signup_log > signup_total doesn't exist!."
EDIT: Fixed this, it says to name the new file "signup_handler_field_signups_total.inc" but it should be "signup_handler_field_signup_total.inc". Notice the singular signup. This should fix the problem.
Comment #8
dww@all: Once an issue is marked duplicate, please read the other issue and comment there, don't continue to post to the duplicate issue.