Support

Home Forums Event Espresso Premium IF EXPIRED do this, write that

IF EXPIRED do this, write that

Posted: September 11, 2013 at 7:26 am

Viewing 8 reply threads


Klaus M

September 11, 2013 at 7:26 am

hi guys, i’d like to add some text, graphics and video as soon as the registration time is over. something like:

<?php if (REGISTRATION TIME IS OVER()) {

do this

<?php }else{ ?>

do that

<?php } ?>

i tried several variables, but couldn’t get it done ;( any idea or help?

thanks!


Josh

  • Support Staff

September 11, 2013 at 11:14 am

The event_espresso_get_is_active function (located in main.php) will run a check and return the registration status of the event. You can review how it’s used in some of the built in Event Espresso templates such as /templates/event_list.php, /templates/event_list_display.php and /templates/registration_page.php.


Klaus M

September 12, 2013 at 3:28 am

Thanks. I tried

<?php if (event_espresso_get_status($event_id) == ‘REGISTRATION_CLOSED’) { ?>
DO THIS
<?php }else{ ?>
DO THAT
<?php } ?>

Didn’t work. if-STATEMENT looks correct, doesn’t it?


Tony

  • Support Staff

September 12, 2013 at 3:49 am

Hi Klaus,

The function event_espresso_get_is_active() returns an array containing more than just the status as above.

Look in event_list_display.php lines line 24 – 35 for an example in how to use the function. See how $status[‘status’] is used?


Klaus M

September 12, 2013 at 9:10 am

I don’t get it ;(

What is wrong with

<?php if ($num_attendees <= $reg_limit && $status == ‘REGISTRATION_OPEN’){ ?> DO THIS <?php } ?>

???


Sidney Harrell

September 12, 2013 at 9:04 pm

Try:

<?php
if ($num_attendees <= $reg_limit && $status['status'] == 'REGISTRATION_OPEN'){
?>
DO THIS
<?php } ?>

Which file are you placing the code in?


Klaus M

September 13, 2013 at 12:21 am

I would like to use it in my own single.php template file within the <This is the registration form> (which i copied from registration_page_display.php). The form works perfect in my template, the <?php if ($num_attendees <= $reg_limit){ ?> works perfect as well, but as soon as i add the
—&& $status == ‘REGISTRATION_OPEN’){ ?>— GAME OVER ;(

I tried using your lines above, but that does not seem to work. Hm ;((

Any idea? Thanks for your help!


Klaus M

September 13, 2013 at 2:58 am

<?php if ($num_attendees >= $reg_limit && $today < $event_registration_end){?>

WORKED FOR ME!


Dean

September 13, 2013 at 10:33 am

Glad you got it sorted!

Viewing 8 reply threads

The support post ‘IF EXPIRED do this, write that’ 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