aboutsummaryrefslogtreecommitdiff
path: root/actions/event_calendar/manage_subscribers.php
blob: 21215008293da4f704bb864dc98916fbb7115931 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
$event_guid = get_input('event_guid');
$event = get_entity($event_guid);
if (elgg_instanceof($event,'object','event_calendar') && $event->canEdit()) {
	$members = get_input('members');
	// clear the event from all personal calendars
	remove_entity_relationships($event_guid, 'personal_event', TRUE);
	// add event to personal calendars
	foreach ($members as $user_guid) {
		add_entity_relationship($user_guid,'personal_event',$event_guid);
	}
	system_message(elgg_echo('event_calendar:manage_subscribers:success'));
	forward($event->getURL());
} else {
	register_error(elgg_echo('event_calendar:manage_subscribers:error'));
	forward();
}