From what I have seen, all checks (registration_has_room() and registration_status()) on whether slots are filled for a registration point back to registration_event_count(). It would be great to implement a hook_registration_event_count_alter() so developers can hook in there and alter the count.
My specific use-case is providing online courses where certain registration states I've defined, such as "withdrawn," don't occupy a slot, thus allowing another user to register for the slot that's opened up. So far, with the above described approach, I haven't found any gotchas.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | registration_add_hook_registration_event_count_alter-1904412-1.patch | 660 bytes | mlsamuelson |
Comments
Comment #1
mlsamuelson commentedPatch attached.
Comment #2
mlsamuelson commentedMis-identified the hook I meant to provide in the issue title. Updated that.
Comment #3
jameswoods commentedThanks for posting this. I too had need to alter the counts and this hook allowed me to do so. I really appreciate you posting this hook.
-James
Comment #4
levelos commentedThanks @mlsamuelson, committed. I also added the hook definition to registration.api.php.
Comment #5.0
(not verified) commentedMis-identified the hook in my original post.
Comment #7
colincalnan commentedCould someone post an example of implementing their alter(). I'm trying to get this working, but the count value is not making it back to the original count function.
Comment #8
mlsamuelson commented@colincalnan
So... in Entity Registration, the alter is invoked like so:
drupal_alter('registration_event_count', $count, $context);With a drupal_alter(), the second and third arguments are passed by reference, meaning any assignments you make to those values won't need to be returned - they'll automatically be felt in the code calling the drupal_alter().
You could implement your own alter by dropping the following into your module (where the name of your module is "mymodule"):