$actual_uid_dates[$uid] = array_intersect_key( get_user_meta($uid, 'sheduleGrafic', false)[0], array_flip($actual_dates) );
add_action( 'wp_dashboard_setup', 'es_dashboard_userlastEvents_widget' );
function es_dashboard_userlastEvents_widget() {
wp_add_dashboard_widget( 'es_lastEvent_Widget', 'Ближайшие мероприятия с Вашим участием', 'es_getUserLastEvents' );
}
function es_getUserLastEvents( $post, $callback_args ) {
$current_user_id = get_current_user_id();
$args = array(
'post_type' => 'dk_events',
'meta_query' => array(
'relation' => 'OR',
array( 'key' => 'event_manager', 'value' => "$current_user_id", ),
array( 'key' => 'sound_engineer', 'value' => "$current_user_id", ),
array( 'key' => 'sound_assistant', 'value' => "$current_user_id", ),
array( 'key' => 'light_engineer', 'value' => "$current_user_id", ),
array( 'key' => 'light_assistant', 'value' => "$current_user_id", ),
array( 'key' => 'video_engineer', 'value' => "$current_user_id", ),
),
'meta_key' => 'start_date',
'orderby' => 'meta_value_num',
'order' => 'ASC',
);
$events = array();
$result = new WP_Query( $args ); $out="";
if(!empty($result) ){
foreach($result->posts as $post) {
$type = get_field('event_type', $post->ID)->name;
$event_title = es_getEvent_title($post->ID);
$location = get_field('event_location', $post->ID)->name;
$start_date = get_field('start_date',$post->ID);
$start_time = get_field('start_time',$post->ID);
$end_time = get_field('end_time',$post->ID);
$url = get_permalink( $post->ID );
$out .= '<div class="row my-1 event_list_">'.$start_date.' в '.$start_time.' '.$type.' '. $event_title.'</div><hr>';
}
} else { $out .= "Мероприятий не найдено.."; }
echo $out;
}
<?php
// Время проверки настроек
function rotator_cron_controlInterval( $rotator_customPeriod ) {
$rotator_controlPeriod = array();
$rotator_controlPeriod['mediastorage_control_scan_shedule']['interval'] = 3600;
$rotator_controlPeriod['mediastorage_control_scan_shedule']['display'] = 'Период проверки автоматизации ротатора.';
return $rotator_controlPeriod;
}
add_filter( 'cron_schedules', 'rotator_cron_controlInterval');
add_action( 'rotator_cron_control', 'rotator_cronControl', 10, 3 );
if( !wp_next_scheduled('rotator_cron_control') ) wp_schedule_event( time(), 'mediastorage_control_scan_shedule', 'rotator_cron_control');
// Время проверки медиабазы
function rotator_cronInterval( $rotator_customPeriod ) {
$scan_options = get_option('rotator_options'); $rotator_customPeriod = array();
if( isset($scan_options['mediastorage_scan_shedule']) AND !empty($scan_options['mediastorage_scan_shedule']) ){
$rotator_customPeriod['mediastorage_scan_shedule']['interval'] = (int)$scan_options['mediastorage_scan_shedule']*60;
$rotator_customPeriod['mediastorage_scan_shedule']['display'] = 'Период автоматизации ротатора, заданный в настройках.';
}
else {
$rotator_customPeriod['mediastorage_scan_shedule']['interval'] = (60*60)*365;
$rotator_customPeriod['mediastorage_scan_shedule']['display'] = 'Минимальный период автоматизации ротатора по умолчанию (Раз в год).';
}
return $rotator_customPeriod;
}
add_filter( 'cron_schedules', 'rotator_cronInterval');
function rotator_cronControl(){
$scan_options = get_option('rotator_options');
if( isset($scan_options['mediastorage_scan_mode']) AND !empty($scan_options['mediastorage_scan_mode']) AND $scan_options['mediastorage_scan_mode'] =="on")
{ if( !wp_next_scheduled('rotator_cron_medialib_scan_check') ){ wp_schedule_event( time(), 'mediastorage_scan_shedule', 'rotator_cron_medialib_scan_check' ); } }
else { $medialib_scan_check = wp_next_scheduled( 'rotator_cron_medialib_scan_check' );
if( $medialib_scan_check ) { wp_unschedule_event( $medialib_scan_check, 'rotator_cron_medialib_scan_check');} }
}
add_action( 'rotator_cron_medialib_scan_check', 'rotator_scanCheck', 10, 3 );
?>
Есть подозрение, что не всегда работает data.append("action", action); Но почему..