Posted: January 4, 2015 at 7:26 pm
|
WP 3.9.6, EE 3.1.36.5.P with MER 1.0.5.p, Members 1.9.8.p, Calendar 2.2.4.p and Business License Happy New Year all! We see the click event handler jQuery(‘body’).on(‘click’, ‘.ee_add_item_to_cart’,function(e){…} in the script espresso_cart_functions.js. Would this be a logical place to add the login check-in? Is there already an EE JS function for doing this that could be called? Thanks in advance! |
|
Hi, Yes espresso_cart_functions.js would be the logical place to add that sort of modification, but please note that that is a core file. Modifications to it will be over written on plugin update. So, I would suggest creating a custom function based on espresso_load_jquery in espresso.php that would load a different version of the espresso_cart_functions.js file, one with your modifications (espresso_load_jquery is a pluggable function). You would still need to check this file in relation to espresso_cart_functions.js every single update, in case of changes, but at least that way it won’t simply delete your changes. In theory you could also use unbind() or off() to disable the click events via a different JavaScript file. I had some difficulty to get it to work, but I am not a master of jQuery. |
|
Hi Dean, Just in case you missed the question, is there an EE check within a script for seeing if a user is checked in? I’ve seen a few approaches on Google for doing this, but if it’s already available in EE, it seems better to use that functionality. |
Hi there, Event Espresso doesn’t have JS function to check whether the user is logged in. However, WP has a PHP function that’s built in: http://codex.wordpress.org/Function_Reference/is_user_logged_in |
|
The support post ‘Check if user logged in after clicking Add to Cart button’ 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.