Answers.Body: <p>Currently we use this as a workaround:
  In CRM/Event/Form/Registration/ParticipantConfirm.php we manually edit the emptyseats to allow the registration to finish.</p>
  
  <pre><code>//Allow confirmation even when waitlist is still on
  $emptySeats = 99
  //$emptySeats = CRM_Event_BAO_Participant::pendingToConfirmSpaces($this-&gt;_eventId);
  </code></pre>
  
  <p>In this way the event is still full and new registrations will be on the waitlist. But the people I manually edited to "pending from Waitlist" can finish their registration.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T12:14:28.430Z
Answers.Text: Of course we rather be able to make an extension of this, instead of editing core files. But I would not know how to do that and if there would be a hook to use for this purpose. Another scenario: why not just allow 'pending waitlist' people to be able to register. Or: have a setting for this behavior.
Answers.UserDisplayName: Richard van Oosterhout
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T12:26:48.447Z
Answers.Text: suggestion #1: add a new setting: "offer waitlist from" (So Max.Participans can be 40 and 'Waitlist threshold' can be 30) 
  suggestion #2: add a new setting: "allow pending waitlist to finish registration"
Answers.UserDisplayName: Richard van Oosterhout
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-13T09:11:24.500Z
Answers.Text: Richard while you've identified that it's not best practice to patch core files, are you aware that you can keep these modified files in a civix-generated extension? Just copy them to the equivalent path in your extension. Overrides still require review/update at upgrade time - [this extension](https://civicrm.org/extensions/extension-file-overrides) can help you keep track.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-14T10:33:59.690Z
Answers.Text: Thanks for bringing this solution up, I will think about it. It still would not remove the requirement for a manual action during upgrade (which for me now is, edit a core file). I wonder if there would be a hook to use to change the value.
Answers.UserDisplayName: Richard van Oosterhout
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-14T17:25:57.400Z
Answers.Text: If there isn't (yet), you can implement the setting/hook required, then use your modified code from the extension while it makes its way into core via a PR.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T12:13:31.810Z
Answers.LastActivityDate: 2018-01-22T12:13:31.810Z
Answers.UserDisplayName: Richard van Oosterhout
Answers.Body: <p>If you want to do this in an extension it would depend in where the data would be coming in. If you are using CiviCRM to create an event I would use the buildForm hook (details: <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/</a>) to set defaults for the field and set it to read only.</p>
  
  <p>If you are using webform-civicrm and the data is coming in with the API (when an event is created from the website) you could use the apiWrappers hook to override the data coming in (details: <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_apiWrappers/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_apiWrappers/</a>). 
  For the latter approach I have developed an extension that might jumpstart you  if you play a little with it: <a href="https://lab.civicrm.org/extensions/contactspecificapidefaults" rel="nofollow noreferrer">https://lab.civicrm.org/extensions/contactspecificapidefaults</a>. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-14T10:31:55.000Z
Answers.LastActivityDate: 2019-01-14T10:31:55.000Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>When an event fills as an event organizer you want some flexibility on who you would grant the last places from your waitlist to. For our summercamps we take into account if people already have brothers and sisters in our other camps and if the family also booked in the last years.</p>
  
  <p>This means we would like to manually 'grant' the last places to some of the people on our waitlist. Therefore we change the participant status to 'Pending from waitlist' in order for the registrant to finish the registration.</p>
  
  <p>Unfortunately this cannot proceed, because of the 'maximum participants' setting. I would advocate for a setting to be able to override the max.participant setting when people finish their registration.</p>
  
  <p>I do not know which files would be related to this 'maximum check' and what good ways would be to be able to override it.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-13T07:58:33.670Z
Comments.Text: Thinking in another direction: How would I be able to override the $emptySeats setting in CRM/Event/Form/Registration/ParticipantConfirm.php from an extension?
Comments.UserDisplayName: Richard van Oosterhout
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-13T23:56:05.553Z
Comments.Text: Could you just 'reserve' several of the places with fake contacts until you are ready to do your final allocation? Also pls note you should not ask a Question in the Answer section, so either add to original question, as a comment, or make a new Question
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-14T18:05:33.130Z
Comments.Text: Using the buildForm hook (see answer above)
Comments.UserDisplayName: ErikH - CiviCooP
Tags: <civievent>
Title: Manually 'Grant' last event places by 'Pending from waitlist' and override 'max participants'
ThreadText: # Manually 'Grant' last event places by 'Pending from waitlist' and override 'max participants'
  
  (Asked by: username_0 on 2015-06-22)
  
  When an event fills as an event organizer you want some flexibility on who you would grant the last places from your waitlist to. For our summercamps we take into account if people already have brothers and sisters in our other camps and if the family also booked in the last years.
  
  This means we would like to manually 'grant' the last places to some of the people on our waitlist. Therefore we change the participant status to 'Pending from waitlist' in order for the registrant to finish the registration.
  
  Unfortunately this cannot proceed, because of the 'maximum participants' setting. I would advocate for a setting to be able to override the max.participant setting when people finish their registration.
  
  I do not know which files would be related to this 'maximum check' and what good ways would be to be able to override it.
  
  **Tags:** civievent
  
  > **Comments:**
  > **username_0**: Thinking in another direction: How would I be able to override the $emptySeats setting in CRM/Event/Form/Registration/ParticipantConfirm.php from an extension?  
  > **username_1**: Could you just 'reserve' several of the places with fake contacts until you are ready to do your final allocation? Also pls note you should not ask a Question in the Answer section, so either add to original question, as a comment, or make a new Question  
  > **username_2**: Using the buildForm hook (see answer above)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-01-22. Score: 3
  
  Currently we use this as a workaround:
  In CRM/Event/Form/Registration/ParticipantConfirm.php we manually edit the emptyseats to allow the registration to finish.
  
  ```
  //Allow confirmation even when waitlist is still on
  $emptySeats = 99
  //$emptySeats = CRM_Event_BAO_Participant::pendingToConfirmSpaces($this->_eventId);
  
  ```
  
  In this way the event is still full and new registrations will be on the waitlist. But the people I manually edited to "pending from Waitlist" can finish their registration.
  
  > **Comments:**
  > **username_0**: Of course we rather be able to make an extension of this, instead of editing core files. But I would not know how to do that and if there would be a hook to use for this purpose. Another scenario: why not just allow 'pending waitlist' people to be able to register. Or: have a setting for this behavior.  
  > **username_0**: suggestion #1: add a new setting: "offer waitlist from" (So Max.Participans can be 40 and 'Waitlist threshold' can be 30)  suggestion #2: add a new setting: "allow pending waitlist to finish registration"  
  > **username_3**: username_0 while you've identified that it's not best practice to patch core files, are you aware that you can keep these modified files in a civix-generated extension? Just copy them to the equivalent path in your extension. Overrides still require review/update at upgrade time - [this extension](https://civicrm.org/extensions/extension-file-overrides) can help you keep track.  
  > **username_0**: Thanks for bringing this solution up, I will think about it. It still would not remove the requirement for a manual action during upgrade (which for me now is, edit a core file). I wonder if there would be a hook to use to change the value.  
  > **username_3**: If there isn't (yet), you can implement the setting/hook required, then use your modified code from the extension while it makes its way into core via a PR.  
  
  ---
  
  ### Answer by username_2 on 2019-01-14. Score: 3
  
  If you want to do this in an extension it would depend in where the data would be coming in. If you are using CiviCRM to create an event I would use the buildForm hook (details: <https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/>) to set defaults for the field and set it to read only.
  
  If you are using webform-civicrm and the data is coming in with the API (when an event is created from the website) you could use the apiWrappers hook to override the data coming in (details: <https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_apiWrappers/>).
  For the latter approach I have developed an extension that might jumpstart you if you play a little with it: <https://lab.civicrm.org/extensions/contactspecificapidefaults>.
  
  
  ---
  
  