Hi,

it would be very cool to have the number of signups under the article on the frontpage and in the upcoming events block.
Maybe like this -> "(NumberOfSignups/TotalSeats)

Comments

roald’s picture

It would also be nice to have "Number of signups for current node" available as a view field!

rokr’s picture

I've been looking for the same feature and stumbled upon this thread. Just wanted to let you know this would be a nice feature. A social site could profit a lot while showing relevant events (with many subscribers) first in lists for example.

dww’s picture

#2 is easy (exporting to views). #1 is more of a pain and more far-reaching. Not sure what to do about that. I'd be tempted to just stuff it into the $node object in nodeapi('load') and then let people mess with that in their theme if they so desire.

dww’s picture

FYI: There's some sample code in the duplicate #278916: Here is code to add signup total to views for this... I'm not sure that's the best approach, since we'd be doing an additional query for every node in a view, but there might not be a better option. I'll see if I can talk to some views experts about that.

dww’s picture

Status: Active » Postponed

Actually, #292835: Add Views Sort to sort by number of user's who signup for a node is the best approach to something like this, but it requires the following patch to views: #143888: support subqueries. Marking this postponed until #143888 lands, then we can use a very similar approach as #292835 to provide the total number of signups directly via a subquery, instead of doing it via tons of extra queries in the views handler.

dobe’s picture

Doesn't http://drupal.org/project/signup_status Module handle what your looking for?

dww’s picture

Nope. signup_status is a fancy way to add 1 "real" extra field to the signup form, beyond the weird theme-based hack that signup itself supports to customize the form. What this issue about is having a view of signup-enabled nodes that includes a field for the # of users who signed up for each node.

dobe’s picture

You are correct but within signup_status there is a view field "Signup Status: Limit" that shows Number of Signup's / Signup Limit for each status.

pablopivetta’s picture

The view field "Signup Status: Limit" displays the signup limit, but how did you manage to show the total number of signups for a node?

kassissieh’s picture

I have written some code to add a signups/limit field to views. I would appreciate your feedback/suggestions on this approach.

http://drupal.org/node/278916#comment-1920842

seehui’s picture

@kassissieh:

I had tried it, but nothing happens. I'm using drupal ver. 6.13, Event ver. 6.x-2.x-dev, Signup ver. 6.x-1.0-rc3

wgold’s picture

You can use "Views Customfield" (http://drupal.org/project/views_customfield) and the views_customfield.sorting.patch. (http://drupal.org/node/336014).

In your node type view you can create a field of type "Customfield: PHP Code" and enter:

$sql = 'SELECT COUNT(*) FROM signup_log WHERE nid =  "' . $data->nid . '"';
$results = db_query($sql);  // Run the query
$signcount = db_result($results);
echo $signcount;

With the sorting patch, you can create a "hitlist" of signed up nodes.

jeffschuler’s picture

Version: 5.x-2.x-dev » 6.x-1.x-dev
Status: Postponed » Needs review
StatusFileSize
new1.84 KB

Patch for signup 6.x-1.x-dev to add a Signup Count field in Views, based on the strategies in #278916: Here is code to add signup total to views.

@dww are you still opposed to this route?

MasterChief’s picture

Hi jeffschuler !

Did your patch provides a filter as well ?

I would like a filter in views (3.x) with the count of signups per node.

If it's doesn't do it, could you try to make a patch ? i would be happy to test it.

jeffschuler’s picture

StatusFileSize
new5.43 KB

This patch cleans up the field handler and adds click-sortability, a sort handler and a filter handler.

I'm not sure if this subquery is the best way to go about this, so I'd appreciate feedback.

MasterChief’s picture

Hi jeffschuler !

Thank you for your patch, i am testing the filter and it's working well and i would like to know if it possible to have a select list for it, for example 0 => Empty and 1 and more => Not empty.

So a filter with a type of many_to-one not numeric, i am saying this because if you expose the filter you can't choose the options.

If you don't understand what i am saying let me know.

jeffschuler’s picture

Hi MasterChief:
This is a numeric field; the filter should reflect that.
You can checkmark the Unlock Operator option on your exposed filter to allow changing of options.

MasterChief’s picture

Thank you for your answer

I tested the unlock operator option but it doesn't let make the example above, how can i change the filter into many_to_one because i would like something like the example.

Is it maybe possible a second filter ? (Keep this filter and add another one?)

I tested too the sort option, it works well, great job :)

jeffschuler’s picture

MasterChief, thanks for reviewing.

So, you're looking for an exposed filter that allows filtering results by those that either have or don't have signups, (at all, regardless of number -- just boolean). Am I understanding correctly?

This seems a special enough case that IMHO doesn't warrant inclusion in this module... maybe a maintainer has an opinion?

You could write a custom module that adds a similar filter handler as I've added here, but extending from views_handler_filter_boolean_operator instead of views_handler_filter_numeric... and putting the value comparison logic in code.

You might also check out the Views Hacks and Better Exposed Filters modules. At a glance, it doesn't look like they have what you're looking for, but you might be able to make the case for adding to the functionality of the numeric filter to allow boolean logic.

MasterChief’s picture

" So, you're looking for an exposed filter that allows filtering results by those that either have or don't have signups, (at all, regardless of number -- just boolean). Am I understanding correctly? "

Yes (no signup=0, signups > 0)

" You could write a custom module that adds a similar filter handler as I've added here, but extending from views_handler_filter_boolean_operator instead of views_handler_filter_numeric... and putting the value comparison logic in code. "

If i make a new file with this :

class signup_handler_filter_signup_count extends views_handler_filter_boolean_operator {
  function get_value_options() {
    $this->value_options = array(0 => t('Empty'), 1 => t('Not Empty'));
  }
}

How you will do the SQL request ?

jeffschuler’s picture

SELECT nid>0 FROM {signup_log} WHERE nid = %d LIMIT 0,1
There are probably smarter ways ways...

@MasterChief: Can you open a new issue for this (if it's still pertinent)? I'd like to focus on the original issue to try and get this through.

wayne57’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

Has anybody got a way to actually show the number of sign ups for a particular node and allow this to be built in a view. There is similar functionality in the image gallery module where the number of images in a gallery can be displayed. Any way of showing this for signups?

qasimzee’s picture

subscribe

efitzg’s picture

Status: Needs review » Fixed

For those having similar issues and not bothering to read #292835: Add Views Sort to sort by number of user's who signup for a node linked above

http://drupal.org/project/signup_counts

works perfectly for me to solve all of these issues

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

digitopo’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev

Anyway to get the signup count functionality in D7?

I would like to be able to show [Total Signups/Spots available] in a view which lists all my upcoming events.

jerenus’s picture

Title: Number of signups » Signup count field in Views 7.x
Component: User interface » Code
Status: Closed (fixed) » Needs review
StatusFileSize
new2.4 KB

Here is the patch of signup count field in views in D7.

jerenus’s picture

Forget add the files[] = views/handlers/signup_handler_field_signup_count.inc to .info file.
New one.

jerenus’s picture

Without results repeat.

digitopo’s picture

Thanks for the patch, I will try it out when I get a chance!

BarisW’s picture

Thanks! Does this only add a Signup count? Or also the Total count?

I'd like to display the following: 5/10 signups.

rudivanes’s picture

I installed the patch. The field is available in the view however it indicates: broken/missing handler when I add the field.
Any suggestions!

rudivanes’s picture

A registry rebuild did the trick.

bassplaya’s picture

Issue summary: View changes

Hi guys,

I tried to put this in the signup.views.inc file to have a filter based on the signup_count but that doesn't seem to work.
I put this in after line 302:

    // Information for accepting signup_count as a filter
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
      'help' => t('Filter by the number of users who have signed up so far.'),
      'label' => 'Signup count',
    ),

The error that I get is:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'signup_log.signup_count' in 'where clause'

I've been looking around but I have no idea how to fix this issue.
Anyone? Or should this be a post on its own?
Cheers!