/*
This custom conditional placeholder shows the format per booking spaces available
sample usage:
{has_owner_x}
Test
{/has_owner_x}
where x is the user id
*/
add_action('em_event_output_condition', 'my_em_custom_event_output_condition', 1, 4);
function my_em_custom_event_output_condition($replacement, $condition, $match, $EM_Event){
if( is_object($EM_Event) && preg_match('/^has_owner_([a-zA-Z0-9_\-]+)$/',$condition, $matches) ){
if( $EM_Event->get_contact()->ID == $matches[1] ){
$replacement = preg_replace("/\{\/?$condition\}/", '', $match);
}else{
$replacement = '';
}
}
return $replacement;
}
Comments