我制作了一个使用Google Calendar API和Oauth2的小应用程序。现在,我想允许用户在活动中回答。这是我的代码:
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>
但它不起作用,当我提交表单时,用户的回复状态不会改变。这是怎么回事?
事件创建者/所有者无法修改与会者的响应。只有与会者可以修改其状态。与会者需要自己从谷歌日历用户界面进行响应,或者您需要作为与会者用户进行身份验证并更改他们的响应状态。