How can I fetch the number of participants(quota) who can register for an event and

the max number of participants in an event if the event has not started on the manage events


There is a BAO function in CiviCRM which returns the available slots for registration


You can use api to get the max number of participant for an event

$result = civicrm_api3('Event', 'getvalue', [
  'return' => "max_participants",
  'id' => 1,

To answer your question in detail, you canuse pagerun hook on event page and then get the variable assigned in smarty using $rows = $page->get_template_vars('rows'); override the variable to add or remove values and then assign it back to smarty using $page->assign('rows' $rows);



  • How can I use this in manage events page,since it's not a form so probably can't use hook buildform, I was looking to get the value in the $row in the template where we have variables like $row.id, $row.repeat etc,if overriding tpl adding it in custom template section is not good practice,kindly suggest a way which is recommended,I am sorry if my question is silly – harshal Jan 11 '19 at 2:20
  • 1
    Updated the answer for your question – Pradeep Nayak Jan 11 '19 at 5:08

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.