From 1ca017f9f9f8b44fbdcb08105a52e059df6bb504 Mon Sep 17 00:00:00 2001 From: Kevin Jardine Date: Wed, 19 Oct 2011 19:56:43 +0200 Subject: added proper check for group enabled calendar and renamed some deprecated functions --- models/model.php | 8 ++++---- start.php | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/models/model.php b/models/model.php index f2f48ca11..7f6c3d39d 100644 --- a/models/model.php +++ b/models/model.php @@ -859,8 +859,8 @@ function event_calendar_format_time($date,$time1,$time2='') { } function event_calendar_activated_for_group($group) { - $group_calendar = get_plugin_setting('group_calendar', 'event_calendar'); - $group_default = get_plugin_setting('group_default', 'event_calendar'); + $group_calendar = elgg_get_plugin_setting('group_calendar', 'event_calendar'); + $group_default = elgg_get_plugin_setting('group_default', 'event_calendar'); if ($group && ($group_calendar != 'no')) { if ( ($group->event_calendar_enable == 'yes') || ((!$group->event_calendar_enable && (!$group_default || $group_default == 'yes')))) { return true; @@ -870,7 +870,7 @@ function event_calendar_activated_for_group($group) { } function event_calendar_get_region($event) { - $event_calendar_region_list_handles = get_plugin_setting('region_list_handles', 'event_calendar'); + $event_calendar_region_list_handles = elgg_get_plugin_setting('region_list_handles', 'event_calendar'); $region = trim($event->region); if ($event_calendar_region_list_handles == 'yes') { $region = elgg_echo('event_calendar:region:'.$region); @@ -879,7 +879,7 @@ function event_calendar_get_region($event) { } function event_calendar_get_type($event) { - $event_calendar_type_list_handles = get_plugin_setting('type_list_handles', 'event_calendar'); + $event_calendar_type_list_handles = elgg_get_plugin_setting('type_list_handles', 'event_calendar'); $type = trim($event->event_type); if ($event_calendar_type_list_handles == 'yes') { $type = elgg_echo('event_calendar:type:'.$type); diff --git a/start.php b/start.php index 24a100f9f..ed0ba41db 100644 --- a/start.php +++ b/start.php @@ -107,8 +107,9 @@ function event_calendar_init() { * Add a menu item to an ownerblock */ function event_calendar_owner_block_menu($hook, $type, $return, $params) { + elgg_load_library('elgg:event_calendar'); if (elgg_instanceof($params['entity'], 'group')) { - if ($params['entity']->event_calendar_enable != "no") { + if (event_calendar_activated_for_group($params['entity'])) { $url = "event_calendar/group/{$params['entity']->guid}"; $item = new ElggMenuItem('event_calendar', elgg_echo('event_calendar:group'), $url); $return[] = $item; -- cgit v1.2.3