Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function calendar_menu()
- {
- global $wpdb;
- // Set admin as the only one who can use Calendar for security
- $allowed_group = 'manage_options';
- // Use the database to *potentially* override the above if allowed
- $configs = $wpdb->get_results("SELECT config_value FROM " . WP_CALENDAR_CONFIG_TABLE . " WHERE config_item='can_manage_events'");
- if (!empty($configs))
- {
- foreach ($configs as $config)
- {
- $allowed_group = $config->config_value;
- }
- }
- // Add the admin panel pages for Calendar. Use permissions pulled from above
- if (function_exists('add_menu_page') && !current_user_can('manage_options'))
- {
- add_menu_page(__('Calendar','calendar'), __('Calendar','calendar'), $allowed_group, 'calendar', 'edit_calendar');
- }
- if (function_exists('add_submenu_page') && !current_user_can('manage_options'))
- {
- add_submenu_page('calendar', __('Manage Calendar','calendar'), __('Manage Calendar','calendar'), $allowed_group, 'calendar', 'edit_calendar');
- add_action( "admin_head", 'calendar_add_javascript' );
- // Note only admin can change calendar options
- add_submenu_page('calendar', __('Manage Categories','calendar'), __('Manage Categories','calendar'), 'manage_options', 'calendar-categories', 'manage_categories');
- add_submenu_page('calendar', __('Calendar Config','calendar'), __('Calendar Options','calendar'), 'manage_options', 'calendar-config', 'edit_calendar_config');
- }
- }
Add Comment
Please, Sign In to add comment