You are here

function node_registration_event_count in Node registration 7

Return the number of registrations for a given node.

4 calls to node_registration_event_count()
node_registration_entity_view in ./node_registration.module
Implements hook_entity_view().
node_registration_form in includes/node_registration.forms.inc
The registration form. It takes a (mandatory) existing or empty registration object.
node_registration_metadata_entity_get_properties in includes/node_registration.entity.inc
Callback for getting properties of an entity.
_node_registration_event_has_room in includes/node_registration.api.inc
Helper to determine if a node has any slots left.

File

includes/node_registration.api.inc, line 672
Registration API functions.

Code

function node_registration_event_count($node) {
  $nid = $node->nid;
  $count = db_query("SELECT sum(slots) FROM {node_registration} WHERE nid = ? AND cancelled = 0", array(
    $nid,
  ))
    ->fetchField();
  return (int) $count;
}