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


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!

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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  Kevin Doherty 8 years, 3 months ago ago

Topic Tags

Tagged: 

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!