aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Jardine <kevinjardine@yahoo.com>2012-01-25 11:48:15 +0100
committerKevin Jardine <kevinjardine@yahoo.com>2012-01-25 11:48:15 +0100
commita62fc25059fb7b67358b285b6d6f3a4a469f35bb (patch)
treee4d2348ea575613a38dfcf8523ac9bfb4ece3dfb
parent2cef39baed704f34c54221301a214f363d2ce65a (diff)
downloadelgg-a62fc25059fb7b67358b285b6d6f3a4a469f35bb.tar.gz
elgg-a62fc25059fb7b67358b285b6d6f3a4a469f35bb.tar.bz2
removed calendar entity menu items if no user is logged in
-rw-r--r--start.php54
1 files changed, 28 insertions, 26 deletions
diff --git a/start.php b/start.php
index 5cfc9fd3a..607a3be7c 100644
--- a/start.php
+++ b/start.php
@@ -274,38 +274,40 @@ function event_calendar_entity_menu_setup($hook, $type, $return, $params) {
return $return;
}
$user_guid = elgg_get_logged_in_user_guid();
- if (event_calendar_personal_can_manage($entity,$user_guid)) {
- if (event_calendar_has_personal_event($entity->guid,$user_guid)) {
- $options = array(
- 'name' => 'personal_calendar',
- 'text' => elgg_echo('event_calendar:remove_from_the_calendar_menu_text'),
- 'title' => elgg_echo('event_calendar:remove_from_my_calendar'),
- 'href' => elgg_add_action_tokens_to_url("action/event_calendar/remove_personal?guid={$entity->guid}"),
- 'priority' => 150,
- );
- $return[] = ElggMenuItem::factory($options);
+ if ($user_guid) {
+ if (event_calendar_personal_can_manage($entity,$user_guid)) {
+ if (event_calendar_has_personal_event($entity->guid,$user_guid)) {
+ $options = array(
+ 'name' => 'personal_calendar',
+ 'text' => elgg_echo('event_calendar:remove_from_the_calendar_menu_text'),
+ 'title' => elgg_echo('event_calendar:remove_from_my_calendar'),
+ 'href' => elgg_add_action_tokens_to_url("action/event_calendar/remove_personal?guid={$entity->guid}"),
+ 'priority' => 150,
+ );
+ $return[] = ElggMenuItem::factory($options);
+ } else {
+ if (!event_calendar_is_full($entity->guid) && !event_calendar_has_collision($entity->guid,$user_guid)) {
+ $options = array(
+ 'name' => 'personal_calendar',
+ 'text' => elgg_echo('event_calendar:add_to_the_calendar_menu_text'),
+ 'title' => elgg_echo('event_calendar:add_to_my_calendar'),
+ 'href' => elgg_add_action_tokens_to_url("action/event_calendar/add_personal?guid={$entity->guid}"),
+ 'priority' => 150,
+ );
+ $return[] = ElggMenuItem::factory($options); }
+ }
} else {
- if (!event_calendar_is_full($entity->guid) && !event_calendar_has_collision($entity->guid,$user_guid)) {
+ if (!event_calendar_has_personal_event($entity->guid,$user_guid) && !check_entity_relationship($user_guid, 'event_calendar_request', $entity->guid)) {
$options = array(
'name' => 'personal_calendar',
- 'text' => elgg_echo('event_calendar:add_to_the_calendar_menu_text'),
- 'title' => elgg_echo('event_calendar:add_to_my_calendar'),
- 'href' => elgg_add_action_tokens_to_url("action/event_calendar/add_personal?guid={$entity->guid}"),
+ 'text' => elgg_echo('event_calendar:make_request_title'),
+ 'title' => elgg_echo('event_calendar:make_request_title'),
+ 'href' => elgg_add_action_tokens_to_url("action/event_calendar/request_personal_calendar?guid={$entity->guid}"),
'priority' => 150,
);
- $return[] = ElggMenuItem::factory($options); }
+ $return[] = ElggMenuItem::factory($options);
+ }
}
- } else {
- if (!event_calendar_has_personal_event($entity->guid,$user_guid) && !check_entity_relationship($user_guid, 'event_calendar_request', $entity->guid)) {
- $options = array(
- 'name' => 'personal_calendar',
- 'text' => elgg_echo('event_calendar:make_request_title'),
- 'title' => elgg_echo('event_calendar:make_request_title'),
- 'href' => elgg_add_action_tokens_to_url("action/event_calendar/request_personal_calendar?guid={$entity->guid}"),
- 'priority' => 150,
- );
- $return[] = ElggMenuItem::factory($options);
- }
}
$count = event_calendar_get_users_for_event($entity->guid,0,0,true);