Support

Home Forums Event Espresso Premium if statement to check if the user has registered for any classes?

if statement to check if the user has registered for any classes?

Posted: July 31, 2012 at 9:26 am

Viewing 2 reply threads


Kevin Doherty

July 31, 2012 at 9:26 am

I have a link wich directs a user when logged in to “my events”. I’d like to further refine the visibility of that link to only show if the user is not only logged in but has in fact ever registered to a class or has a class in listed in their “my events’ section in the admin.

Any help is greatly appreciated.
thanks!


Josh

  • Support Staff

August 1, 2012 at 9:45 am

<?php 
$sql = "SELECT id FROM ". EVENTS_MEMBER_REL_TABLE . " WHERE user_id = %d";
  if ( $mbr_id = $wpdb->get_var( $wpdb->prepare( $sql, $current_user->ID ))) {
    echo "you have registered for an event";
} else {
     echo "you didn't register for anything yet";
}
?>


Kevin Doherty

August 1, 2012 at 12:00 pm

Awesome, thanks Josh!

Viewing 2 reply threads

The support post ‘if statement to check if the user has registered for any classes?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso