问题描述
我制作了一个使用Google Calendar API和Oauth2的小应用程序.现在,我想允许用户在事件中回答.这是我的代码:
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?
推荐答案
活动创建者/所有者无法修改与会者的响应.只有与会者可以修改其状态.参与者需要自己从Google日历用户界面进行响应,或者您需要通过身份验证为参与者用户并更改其响应状态.
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.
这篇关于更新与会者的响应状态-Google Calendar API(PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!