3

I am trying to delete an event that has participants registered using:

civicrm_api( 'event','delete', array('version' => 3, 'id' => $v) );

Which gives an error saying that I can't delete it because it has participants.

Is there any way to force the deletion of the event? Or how do I remove all participants of the event?

4

You can delete participants from an event using:

civicrm_api3('Participant', 'delete', array(
  'event_id' => $v,
  'options' => array('match' => 'event_id')
));

Once that's done you can proceed to delete the event.

|improve this answer|||||
1

I think you have to delete the event participants from the event before deleting the event, note that this only deletes the participants from the event and not from the db. Go to Events, find participants, select the event -> search, select all and use the action menu to delete participants. After that you can go to Events->Manage events, search and from the more link you can delete the event

|improve this answer|||||

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.