• Resolved lehamill

    (@lehamill)


    I manage a site for the local Submarine Veterans and use Event Manager to list submarines that were lost during the current month. Some time ago I found created a “Current Month” scope to list all the boats lost during the month even after the date has passed. So that all boats lost during that month would be displayed all month long. The scope is not working now and to be honest I don’t know when it stopped. Below is the code I have that used to work.

    Please help.

    /* Create current month scope for event manager */
    add_filter( ’em_events_build_sql_conditions’, ‘my_em_scope_conditions’,1,2);
    function my_em_scope_conditions($conditions, $args){
    if( !empty($args[‘scope’]) && $args[‘scope’]==’currentmonth’ ){
    $start_date = date(‘Y-m’,current_time(‘timestamp’)).’-01′;
    $end_date = date(‘Y-m’,current_time(‘timestamp’)).’-30′;
    $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(
    ‘currentmonth’ => ‘Current Month Not Working’
    );
    return $scopes + $my_scopes;
    }

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Current Month Scope’ is closed to new replies.