Answers.Body: <p>There is a BAO function in CiviCRM which returns the available slots for registration</p>
  
  <pre><code>CRM_Event_BAO_Participant::pendingToConfirmSpaces($eventId);
  </code></pre>
  
  <p>You can use api to get the max number of participant for an event</p>
  
  <pre><code>$result = civicrm_api3('Event', 'getvalue', [
    'return' =&gt; "max_participants",
    'id' =&gt; 1,
  ]);
  </code></pre>
  
  <p>To answer your question in detail, you canuse pagerun hook on event page and then get the variable assigned in smarty using <code>$rows = $page-&gt;get_template_vars('rows');</code> override the variable to add or remove values and then assign it back to smarty using <code>$page-&gt;assign('rows' $rows);</code></p>
  
  <p>HTH</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-11T02:20:56.567Z
Answers.Text: 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
Answers.UserDisplayName: harshal
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-11T05:08:47.270Z
Answers.Text: Updated the answer for your question
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-10T15:40:51.207Z
Answers.LastActivityDate: 2019-01-11T05:08:23.833Z
Answers.LastEditDate: 2019-01-11T05:08:23.833Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>How can I fetch <strong>the number of participants(quota) who can register for an event</strong> and <br>
  <br>the max number of participants in an event  if the event has not started on the manage events </p>
  
Tags: <civievent>
Title: How can I see the quota (number of participants which can still register) under the manage events section?
ThreadText: # How can I see the quota (number of participants which can still register) under the manage events section?
  
  (Asked by: username_0 on 2019-01-10)
  
  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
  
  **Tags:** civievent
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-01-10. Score: 3 | Accepted answer
  
  There is a BAO function in CiviCRM which returns the available slots for registration
  CRM_Event_BAO_Participant::pendingToConfirmSpaces($eventId);
  
  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);
  HTH
  Pradeep
  
  > **Comments:**
  > **username_0**: 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  
  > **username_1**: Updated the answer for your question  
  
  ---
  
  