Support

Home Forums Event Espresso Premium EE4 Reserving Spots Too Long (2)

EE4 Reserving Spots Too Long (2)

Posted: November 26, 2017 at 1:43 am


Peter

November 26, 2017 at 1:43 am

Hi there,

I left the code alone in my website for a while, but I have noticed the issue recurring where a course gets tagged as “sold out” and doesn’t open back up.

I last left off going to test the solution in https://eventespresso.com/topic/ee4-reserving-spots-too-long/ but I now suspect that I don’t have the correct code in my “WordPress Site Plugin”.

Although Tony at the time advised me to change the code to:

apply_filters(
	'FHEE__EE_Session__construct___lifespan',
	60 * MINUTE_IN_SECONDS
)

I have noticed that when I paste that exact same text into my plugin editor that WordPress will not allow the document to be saved, saying “Your PHP code changes were rolled back due to an error on line 70 of file wp-content/plugins/RGSLCustomCSSPlugin/RGSLCustomCSSPlugin-customizations.php. Please fix and try saving again.
syntax error, unexpected end of file”.
I figure maybe I could paste a snippet of the code I’m using, and then see if you might be able to correct it?

I apologize if this seems trivial but I really don’t know how to code very well and have been struggling.

I pasted the code right at the bottom of my document. It looks like:

//* Disable email match check for all users
add_filter( 'EED_WP_Users_SPCO__verify_user_access__perform_email_user_match_check', '__return_false' );

if ( ! function_exists( 'wp_new_user_notification' ) ) :
    function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
        return;
    }
endif;

apply_filters(
	'FHEE__EE_Session__construct___lifespan',
	20 * MINUTE_IN_SECONDS
)

/* Stop Adding Functions */

Are you able to offer any feedback to me? I do see some failed registrations. My partner has described having to “clear out” old registrations, but I’m not 100% sure if they were cleaning out the Failed ones. I do see about 10 “Failed” ones from the last few days or so, so I worry that sales are maybe being lost.

Thanks kindly,
Peter


Tony

  • Support Staff

November 27, 2017 at 3:51 am

My apologies, there seems to be some confusion here as I didn’t advise using that code, it won’t work as is for a couple of reasons.

The reason you’re getting the above error is there is a missing semicolon at the end:

apply_filters(
	'FHEE__EE_Session__construct___lifespan',
	60 * MINUTE_IN_SECONDS
);

I added that code to provide some context on what was happening as it shows the default is 60 * MINUTE_IN_SECONDS, 60 * 60 which equals 3600 (the amount of seconds in 1 hour).

However that’s using apply_filters() which is the function used to apply any filters the user may have hooked in to change the value, so you need code that uses add_filter()

The correct function you had previously was:

add_filter( 'FHEE__EE_Session__construct___lifespan', 'ee_change_reg_time_limit' );
function ee_change_reg_time_limit() {
    return 45 * 1200;
}

But is has 45 * 1200 = 54000, meaning 15 hours.

What this meant was your function was setting the session lifespan to be much longer than EE’s default when you wanted it shorter and that’s why it didn’t appear to work.

You need this code:

add_filter( 'FHEE__EE_Session__construct___lifespan', 'ee_change_reg_time_limit', 20 );
function ee_change_reg_time_limit() {
   return 20 * MINUTE_IN_SECONDS;
}

Add that to your custom function above and it should change the session lifespan to 20 minutes.


Peter

November 28, 2017 at 4:30 am

OK thanks. I have copied and pasted your code in place of what was there. Sorry for the confusion – I will watch the system and report back if it’s still doing the same thing (not releasing seats).

Thanks again!


Tony

  • Support Staff

November 28, 2017 at 4:32 am

You’re most welcome.

Note if you are watching the event you don’t want to site with the event editor open. If the event switches to sold out and you have the event editor open it could trigger an autosave which will save the event as sold out.

So if you’re watching the event, open up the event on the front end and refresh it, you’ll see if the event switches status there rather than in the event editor itself.

The support post ‘EE4 Reserving Spots Too Long (2)’ 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