Support

Home Forums Event Espresso Premium How to move/or scroll to, Espresso Notices (Error Messages)

How to move/or scroll to, Espresso Notices (Error Messages)

Posted: April 9, 2024 at 1:39 am


Digital Services Lab

April 9, 2024 at 1:39 am

My ticket selector is halfway down my page. If I just click ‘Register’ without selecting a ticket qty the following occurs:

  1. The page reloads with an anchor to the ticket selector.. /#tkt-slctr-tbl-1933 which is forceably scrolled to
  2. An error message is displayed at the top of the page, completely out of view to the user
  3. shortly after, the out-of-view error message fades away

The user never sees the message and is not even aware it’s there.

I’ve tried adding a mutationObserver to element the errors are appended to to scroll to it but the errors exist before my script runs.
This approach would also see me battling the anchor scrolling as well which is counterproductive.

How can I either, move the errors to the same container as the ticket selector, or scroll to them instead of the ticket selector.


Sam

  • Support Staff

April 9, 2024 at 4:21 am

Hi Mike,

You can try navigating to your root folder of WordPress installation and find the wp-config.php and look for this code there:

define( 'WP_DEBUG', false );

Make sure it is set to false and save the changes.

If still facing issues please share a screenshot of the issue you are facing.


Digital Services Lab

April 9, 2024 at 5:32 am

wow, really!?!

Espresso Notices (as per title of ticket..) are front-end messages output to users.
They are populated into the ‘div’ with id=”espresso-notices”.

Your response indicates you are not familiar with Event Espresso and also didn’t read the ticket.

As expected, if you click ‘register’ without selecting a ticket qty, you receive an error message…
This has nothing to do with WP_DEBUG and clearly your suggestion doesn’t address the question I’ve asked.


Sam

  • Support Staff

April 9, 2024 at 9:49 am

Hi there,

Sorry for the confusion above. Can you please share a direct link to the page where exactly you are facing the issue so that I can check that for you?

Looking forward to helping you.


Digital Services Lab

April 9, 2024 at 4:09 pm

…it’s the default behaviour of event espresso. You can see it on any EE event page.


Digital Services Lab

April 9, 2024 at 11:03 pm

For anyone else having this issue. I’ve solved it as follows.

The following functions wrap the error notices in a single div. This can then be statically position at the bottom of the screen.
This way, no matter where you are you can always see the error messages EE spits out.

#event-notices-wrapper {
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 999999;
}
/**
 * Wraps the EE notices elements
 * We can position these fixed to the bottom of the page now
 *
 * action documented on  EE_Front_Controller::display_errors()
 * core/EE_Front_Controller.core.php
 * 
 * @return void
 */
function dsl_output_error_message_wrapper_begin() {

    if((is_single() && 'espresso_events' == get_post_type() ) || (is_archive() && 'espresso_events' == get_post_type() )) {
        echo '<div id="event-notices-wrapper">';
    }
}
add_action( 'AHEE__EE_Front_Controller__display_errors__begin', 'dsl_output_error_message_wrapper_begin');

/**
 * Wraps the EE notices elements
 * We can position these fixed to the bottom of the page now
 *
 * action documented on  EE_Front_Controller::display_errors()
 * core/EE_Front_Controller.core.php
 * 
 * @return void
 */
function dsl_output_error_message_wrapper_end() {

    if((is_single() && 'espresso_events' == get_post_type() ) || (is_archive() && 'espresso_events' == get_post_type() )) {
        echo '</div>';
    }
    
}
add_action( 'AHEE__EE_Front_Controller__display_errors__end', 'dsl_output_error_message_wrapper_end');


Sam

  • Support Staff

April 10, 2024 at 1:50 am

Thank you so much for letting us know the steps you made. If you need anything, feel free to reach us again.

have a wonderful day!

The support post ‘How to move/or scroll to, Espresso Notices (Error Messages)’ 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