eventsmanager icon

has_location_x (location_id)

eventsmanager | PRO | 02/13/23 09:02:33 AM UTC | 0 ⭐ | 638 👁️ | Never ⏰ | []
text |

550 B

|

None

|

0 👍

/

0 👎

<?php
 /*
 * usage: {has_location_31} TEST {/has_location_31} where 31 is the Location ID
 */
 add_action('em_event_output_condition', 'my_em_event_output_condition', 1, 4);
function my_em_event_output_condition($replacement, $condition, $match, $EM_Event){
	if( preg_match('/^has_location_([a-zA-Z0-9_\-,]+)$/',$condition, $location_id_match) ){
		if( $EM_Event->get_location()->location_id == $location_id_match[1] ){
			$replacement = preg_replace("/\{\/?$condition\}/", '', $match);
		}else{
			$replacement = '';
		}
	}
	return $replacement;
}

Comments