'0', 'blog'=>get_current_blog_id()))->bookings); } if($bookings_pending_count > 0){ $bookings_num = ''.$bookings_pending_count.''; } }else{ $bookings_num = ''; $bookings_pending_count = 0; } //Count pending events $events_num = ''; $events_pending_count = EM_Events::count(array('status'=>0, 'scope'=>'all', 'blog'=>get_current_blog_id())); //TODO Add flexible permissions if($events_pending_count > 0){ $events_num = ''.$events_pending_count.''; } //Count pending recurring events $events_recurring_num = ''; $events_recurring_pending_count = EM_Events::count(array('status'=>0, 'recurring'=>1, 'scope'=>'all', 'blog'=>get_current_blog_id())); //TODO Add flexible permissions if($events_recurring_pending_count > 0){ $events_recurring_num = ''.$events_recurring_pending_count.''; } $both_pending_count = apply_filters('em_items_pending_count', $events_pending_count + $bookings_pending_count + $events_recurring_pending_count); $both_num = ($both_pending_count > 0) ? ''.$both_pending_count.'':''; // Add a submenu to the custom top-level menu: $plugin_pages = array(); if( get_option('dbem_rsvp_enabled') ){ $plugin_pages['bookings'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Bookings', 'dbem'), __('Bookings', 'dbem').$bookings_num, 'manage_bookings', 'events-manager-bookings', "em_bookings_page"); } $plugin_pages['options'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Events Manager Settings','dbem'),__('Settings','dbem'), 'activate_plugins', "events-manager-options", 'em_admin_options_page'); $plugin_pages['help'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Getting Help for Events Manager','dbem'),__('Help','dbem'), 'activate_plugins', "events-manager-help", 'em_admin_help_page'); //If multisite global with locations set to be saved in main blogs we can force locations to be created on the main blog only if( EM_MS_GLOBAL && !is_main_site() && get_site_option('dbem_ms_mainblog_locations') ){ include( dirname(__FILE__)."/em-ms-locations.php" ); $plugin_pages['locations'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Locations','dbem'),__('Locations','dbem'), 'read_others_locations', "locations", 'em_admin_ms_locations'); } $plugin_pages = apply_filters('em_create_events_submenu',$plugin_pages); //We have to modify the menus manually if( !empty($both_num) ){ //Main Event Menu //go through the menu array and modify the events menu if found foreach ( (array)$menu as $key => $parent_menu ) { if ( $parent_menu[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){ $menu[$key][0] = $menu[$key][0]. $both_num; break; } } } if( !empty($events_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Event Item //go through the menu array and modify the events menu if found foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) { if ( $submenu_item[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){ $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_num; break; } } } if( !empty($events_recurring_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Recurring Event Item //go through the menu array and modify the events menu if found foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) { if ( $submenu_item[2] == 'edit.php?post_type=event-recurring' ){ $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_recurring_num; break; } } } /* Hack! Add location/recurrence isn't possible atm so this is a workaround */ global $_wp_submenu_nopriv; if( $pagenow == 'post-new.php' && !empty($_REQUEST['post_type']) ){ if( $_REQUEST['post_type'] == EM_POST_TYPE_LOCATION && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_locations') ){ unset($_wp_submenu_nopriv['edit.php']['post-new.php']); } if( $_REQUEST['post_type'] == 'event-recurring' && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_recurring_events') ){ unset($_wp_submenu_nopriv['edit.php']['post-new.php']); } } } add_action('admin_menu','em_admin_menu'); function em_ms_admin_menu(){ add_menu_page( __('Events Manager','dbem'), __('Events Manager','dbem'), 'activate_plugins', 'events-manager-options', 'em_ms_admin_options_page', plugins_url('includes/images/calendar-16.png', dirname(dirname(__FILE__)).'/events-manager.php') ); add_submenu_page('events-manager-options', __('Update Blogs','dbem'),__('Update Blogs','dbem'), 'activate_plugins', "events-manager-update", 'em_ms_upgrade'); } add_action('network_admin_menu','em_ms_admin_menu'); function em_admin_init(){ //in MS global mode if( EM_MS_GLOBAL && is_user_logged_in() && !is_main_site() && get_site_option('dbem_ms_mainblog_locations') ){ EM_Object::ms_global_switch(); $user = new WP_User(get_current_user_id()); if( count($user->roles) == 0 ){ $user->set_role('subscriber'); } EM_Object::ms_global_switch_back(); } } add_action('admin_init','em_admin_init'); /** * Generate warnings and notices in the admin area */ function em_admin_warnings() { global $EM_Notices; //If we're editing the events page show hello to new user $events_page_id = get_option ( 'dbem_events_page' ); $dismiss_link_joiner = ( count($_GET) > 0 ) ? '&':'?'; if( current_user_can('activate_plugins') ){ //New User Intro if (isset ( $_GET ['disable_hello_to_user'] ) && $_GET ['disable_hello_to_user'] == 'true'){ // Disable Hello to new user if requested update_option('dbem_hello_to_user',0); }elseif ( get_option ( 'dbem_hello_to_user' ) ) { //FIXME update welcome msg with good links $advice = sprintf( __("
Events Manager is ready to go! It is highly recommended you read the Getting Started guide on our site, as well as checking out the Settings Page. Dismiss
", 'dbem'), 'http://wp-events-plugin.com/documentation/getting-started/?utm_source=em&utm_medium=plugin&utm_content=installationlink&utm_campaign=plugin_links', EM_ADMIN_URL .'&page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'disable_hello_to_user=true'); ?>settings page. Sorry for the extra step! If you know what you are doing, you may have done this on purpose, if so ignore this message', 'dbem'), EM_ADMIN_URL .'&page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_events_page=1' ); ?>
here. Dismiss message','dbem'),admin_url().'network/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].'&disable_dbem_ms_update_nag=1'); ?>
migrate your location and event images in order for them to appear in your edit forms and media library. Dismiss message','dbem'),admin_url().'edit.php?post_type=event&page=events-manager-options&em_migrate_images=1&_wpnonce='.wp_create_nonce('em_migrate_images'), em_add_get_params($_SERVER['REQUEST_URI'], array('disable_dbem_migrate_images_nag' => 1))); ?>
$message