• Resolved Christian Denat

    (@yakafaucon)


    Hello all,

    I want to delete some unused scopes, customise text for others and create a new one (ie, the last 2 weeks)

    I’ve built my own filter function for “em_get_scopes” where I made the changes and all is OK : In the admin events page, I can see only my own and other customised scopes in the select box on top of the table..

    Now I’m trying to make the scope working for my own “last 2 weeks” scope and create a filter for “em_events_build_sql_conditions”.

    I’ve just created the skeletono f my function and put a debug trace inside to see when it is applied…

    add_filter( 'em_events_build_sql_conditions', 'gf38_matchs_quinzaine', 1, 2 );
    function gf38_matchs_quinzaine( $conditions, $args ) {
    	debug_($args['scope']);
    	if ( ! empty( $args['scope'] ) && $args['scope'] == 'derniere-quinzaine' ) {
    		$start_date          = date( 'Y-m-d', current_time( 'timestamp' ) );
    		$end_date            = date( 'Y-m-d', strtotime( "-365 days", current_time( 'timestamp' ) ) );
    		$conditions['scope'] = " (event_start >=  CAST('$end_date' AS DATE) AND event_end <= CAST('$start_date' AS DATE))";
    	}
    
    	return $conditions;
    }

    If I select “my scope” in the select box, I did not catch my own scope but always all or future, depending on the choice I’ve selected !!!

    What is wrong ?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug in scope management in admin page ?’ is closed to new replies.