Posted: March 11, 2019 at 7:05 am
My client wants to prevent a user from registering for an event if they have pending payments for another event (they take payment by check as well as cc)
I think my best bet is to add a snippet in my version of the content-espresso_events-tickets.php file. I have determined where I want to do that…I can just surround the line <?php espresso_ticket_selector( $post ); ?> with an ‘if user has payment outstanding’ statement. So far so good.
I have searched the forum for ways to get if the current user has pending payments but so far have not found anything that seems like what I need.
I tried to figure it out from the models docs but have not been successful.
Can you help me get this figured out?
You’ll first need to make sure there’s a logged in user:
then get the current user’s user ID, and you could use:
then get the EE_Contact record:
then get the registrations:
then loop through the registrations to get registration statuses:
then check for pending payments:
Thanks Josh. That works perfectly. And in the last bit I just added a link to a page where I use the [ESPRESSO_MY_EVENTS template=simple_list_table ] shortcode.
I appreciate your help.