I have been working with Events Espresso for a little while now. It’s a comprehensive plugin but it lacks one handy little feature.. we needed the ability to show content based on the attending status of the currently logged in user. So if the logged in user ‘has purchased’ attendance to a specific event (or events list). Adding the following code to your theme functions.php file or a new plugin will give you access to a new shortcode.

The shortcode accepts ‘id’ and ‘noaccess’ arguments. The id accepts a single number for an event or a list of event ids separated by a | character. ‘noaccess’ is optional but when used it will show the provided message when a user has NOT purchased attendance to the event(s) specified.

The code

add_shortcode('ee_has_purchased', 'sb_ee_has_purchased');

function sb_ee_has_purchased($atts, $content) {
	global $wpdb, $current_user;
	$no_access = (isset($atts['noaccess']) ? wpautop($atts['noaccess']):'');
	if ($current_user->ID) {
		if (isset($atts['id'])) {
			if ($ids = explode('|', $atts['id'])) {
				$sql = 'SELECT COUNT(reg.REG_ID) AS attending
						`' . $wpdb->prefix . 'esp_registration` reg
						JOIN `' . $wpdb->prefix . 'esp_attendee_meta` atm ON (reg.ATT_ID = atm.ATT_ID)
						reg.STS_ID IN ("RAP","TCM","ACT")
						AND reg.EVT_ID IN (' . implode(',', $ids) . ')
						AND atm.ATT_email = "' . $current_user->user_email . '"';
				if (!$wpdb->get_var($sql)) { //if not purchased then clear the content
					$content = $no_access;
	} else {
		$content = $no_access;
	return do_shortcode($content);


[ee_has_purchased id="123|345" noaccess="you do not have access to this content"]

A donate button!

Be the first to hear about new products/updates!

This is a mailing list for those people interested in being told when we release a new product (Divi plugin or Theme).

We shall also use this list to let you know about product updates and releases.

You have Successfully Subscribed!