1

I'd like to be able to notify organizers when a certain number of participants have registered. I don't want to shut down registration or offer a waiting list to participants, I just need the staff notified via email.

Is there a way to do this out-of-the-box? Could I do this with the CiviRules component? If not, other suggestions on hooks/customizations welcome.

Thanks!

System deets: Joomla 3.8.12, CiviCRM 5.3.1

1

It can be easily done using hooks. Max participant is stored in civicrm_event table, so you need to fetch the value and then compare it with the count of participants registered in this event. All this check should be done after a participant is created. So, you could use post hook for the same. Sample(not tested) code is shown below -

function example_civicrm_post($op, $objectName, $objectId, &$objectRef) {
  if ($op == 'create' && $objectName == 'Participant') {
    //check the count of participant in the event
    $participantCount = civicrm_api3('Participant', 'getcount', [
      'event_id' => $objectRef->event_id,
    ]); 

    //Compare it with the max participant value 
    $max = civicrm_api3('Event', 'getvalue', [
      'return' => "max_participants",
      'id' => 1,
    ]);

    //If max equals the count, send an email
    if ($max == $participantCount) {
      //send email to xyz@example.com
    }
  }
}
  • Super, thanks for the suggestion! I'll try it out and let you know. – minbori Oct 10 '18 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.