Problem with EM admin page and scope function
-
Hi guys,
after updating to 5.5.3 I get a white page when I go to EM > Events in the backend. When I go to my EM > Recurring events page in the backend all my recurring events are listet.. Any ideas?
Next issue: To display certain events in a table view I use this code in my page:
<table> <thead> <tr> <th>Day</th> <th>Time</th> <th>Level</th> <th>Studio</th> <th>Teacher</th> <th>Infos</th> </tr> </thead> <tbody> [events_list scope="this-week" limit="100"] <tr> <td>#_ATT{Day}</td> <td>#_EVENTTIMES</td> <td> #_ATT{Level}</td> <td>#_ATT{Studio}</td> <td> #_ATT{Teacher}</td> <td>#_ATT{Infos}</td> </tr> [/events_list] </tbody> </table>
I figured out that the problem is the scope=”this-week” which doesn’t work anymore since the update. The corresponding code in my functions.php is:
$today = getdate(); add_filter( 'em_events_build_sql_conditions', 'my_em_scope_conditions',1,2); if (date('w') == 0) { function my_em_scope_conditions($conditions, $args){ if( !empty($args['scope']) && $args['scope']=='this-week' ){ $now = time(); $start_date = date('Y-m-d',strtotime('monday last week', $now)); $end_date = date('Y-m-d',strtotime('monday last week + 6 days', $now)); $conditions['scope'] = " (event_start_date BETWEEN CAST('$start_date' AS DATE) AND CAST('$end_date' AS DATE)) OR (event_end_date BETWEEN CAST('$end_date' AS DATE) AND CAST('$start_date' AS DATE))"; } if( !empty($args['scope']) && $args['scope']=='next-week' ){ $now2 = time(); $start_date = date('Y-m-d',strtotime('monday this week', $now2)); $end_date = date('Y-m-d',strtotime('monday this week + 6 days', $now2)); $conditions['scope'] = " (event_start_date BETWEEN CAST('$start_date' AS DATE) AND CAST('$end_date' AS DATE)) OR (event_end_date BETWEEN CAST('$end_date' AS DATE) AND CAST('$start_date' AS DATE))"; } return $conditions; } } else { function my_em_scope_conditions($conditions, $args){ if( !empty($args['scope']) && $args['scope']=='this-week' ){ $now = time(); $start_date = date('Y-m-d',strtotime('monday this week', $now)); $end_date = date('Y-m-d',strtotime('monday this week + 6 days', $now)); $conditions['scope'] = " (event_start_date BETWEEN CAST('$start_date' AS DATE) AND CAST('$end_date' AS DATE)) OR (event_end_date BETWEEN CAST('$end_date' AS DATE) AND CAST('$start_date' AS DATE))"; } if( !empty($args['scope']) && $args['scope']=='next-week' ){ $now2 = time(); $start_date = date('Y-m-d',strtotime('monday next week', $now2)); $end_date = date('Y-m-d',strtotime('monday next week + 6 days', $now2)); $conditions['scope'] = " (event_start_date BETWEEN CAST('$start_date' AS DATE) AND CAST('$end_date' AS DATE)) OR (event_end_date BETWEEN CAST('$end_date' AS DATE) AND CAST('$start_date' AS DATE))"; } return $conditions; } } add_filter( 'em_get_scopes','my_em_scopes',1,1); function my_em_scopes($scopes){ $my_scopes = array( 'this-week' => 'This Week', 'this-week' => 'Next Week' ); return $scopes + $my_scopes; }
Any idea where the bug can be?
Thank you!
Micha
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Problem with EM admin page and scope function’ is closed to new replies.