eventsmanager icon

Conditional Placeholder: has_owner_x

eventsmanager | PRO | 01/07/25 09:13:49 AM UTC | 0 ⭐ | 317 👁️ | Never ⏰ | []
text |

630 B

|

None

|

0 👍

/

0 👎

/*
 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