I've made a little application that uses Google Calendar API and Oauth2. Now I would like to allow user to answer at an event. This is my code:
PHP
if(isset($_POST['submit'])){
$eventSubmit = $service->events->get('primary', $_POST['eventID']);
$attendeesSubmit=$eventSubmit->getAttendees();
foreach ($attendees as $attendee) {
$mailSubmit = $attendee->getEmail();
if ($mailSubmit==$emailUser){
if ($_POST['status']=='accepte'){
$attendee->setResponseStatus('accepted');
$service->events->update('primary', $_POST['eventID'], $eventSubmit);
}
if ($_POST['status']=='decline'){
$attendee->setResponseStatus('decline');
}
}
}
HTML
<form method="post" action="index.php">
<input type="radio" name="status" id="accepte" value="accepte">Confirmer</input>
<input type="radio" name="status" id="decline" value="decline">Décliner</input>
<input type="hidden" name="eventID" value="<?php echo htmlspecialchars($event['id']); ?>">
<input type="submit" name="submit" value="OK"></br></br>
But It doesn't work, user's reponse status doesn't change when I'm submit the form. What's the problem?
Event creators/owners can't modify the response of attendees. Only attendees can modify their status. Either attendees will need to respond from the Google Calendar UI themselves or you'll need to authenticate as the attendee user and change their response status.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With