rapsli
Forum Replies Created
-
thanks. This fixed it.
perfect!
ok, unfortunately WPML is not an option in our case.
Hi there
Thanks a lot, so there is no way for translating those custom fields?
great. Could you mention the hook here, maybe it will also be helpful for others.
it works, but then login breaks. That’s why I put the is_login_attempt() there.
I have added to functions: is_login_attempt() and is_my_account_page() and then prevented the cookie to be set if either of these functions return true:
public function init() {
? ? ? ? $cookie = $this->get_session_cookie();
? ? ? ? if ( $cookie ) {
? ? ? ? ? ? $this->_customer_id ? ? ? ?= $cookie[0];
? ? ? ? ? ? $this->_session_expiration = $cookie[1];
? ? ? ? ? ? $this->_session_expiring ? = $cookie[2];
? ? ? ? ? ? $this->_has_cookie ? ? ? ? = true;
? ? ? ? ? ? $this->_data ? ? ? ? ? ? ? = $this->get_session_data();
? ? ? ? ? ? // If the user logs in, update session.
? ? ? ? ? ? if ( is_user_logged_in() && strval( get_current_user_id() ) !== $this->_customer_id ) {
? ? ? ? ? ? ? ? $guest_session_id ? = $this->_customer_id;
? ? ? ? ? ? ? ? $this->_customer_id = strval( get_current_user_id() );
? ? ? ? ? ? ? ? $this->_dirty ? ? ? = true;
? ? ? ? ? ? ? ? $this->save_data( $guest_session_id );
? ? ? ? ? ? ? ? $this->set_customer_session_cookie( true );
? ? ? ? ? ? }
? ? ? ? ? ? // Update session if its close to expiring.
? ? ? ? ? ? if ( time() > $this->_session_expiring ) {
? ? ? ? ? ? ? ? $this->set_session_expiration();
? ? ? ? ? ? ? ? $this->update_session_timestamp( $this->_customer_id, $this->_session_expiration );
? ? ? ? ? ? }
? ? ? ? } else {
? ? ? ? ? ? $this->set_session_expiration();
? ? ? ? ? ? $this->_customer_id = $this->generate_customer_id();
? ? ? ? ? ? $this->_data ? ? ? ?= $this->get_session_data();
? ? ? ? ? ? if ( ! is_user_logged_in() ) {
? ? ? ? ? ? ? ? // Only set session cookie if on my-account page or login attempt
? ? ? ? ? ? ? ? if ($this->is_login_attempt() || $this->is_my_account_page()) {
? ? ? ? ? ? ? ? ? ? $this->set_customer_session_cookie( true );
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? //add_action( 'rtcl_set_cart_cookies', array( $this, 'set_customer_session_cookie' ), 10 ); // TODO :
? ? ? ? add_action( 'shutdown', [ $this, 'save_data' ], 20 );
? ? ? ? add_action( 'wp_logout', [ $this, 'destroy_session' ] );
? ? ? ? if ( ! is_user_logged_in() ) {
? ? ? ? ? ? add_filter( 'nonce_user_logged_out', [ $this, 'nonce_user_logged_out' ] );
? ? ? ? }
? ? }
? ? /**
? ? ?* Check if the current page is the my-account page.
? ? ?*
? ? ?* @return bool
? ? ?*/
? ? private function is_my_account_page() {
? ? ? ? // Check if the function exists
? ? ? ? if (!function_exists('is_page')) {
? ? ? ? ? ? return false;
? ? ? ? }
? ? ? ? // Check by page slug
? ? ? ? if (is_page('my-account')) {
? ? ? ? ? ? return true;
? ? ? ? }
? ? ? ? // Fallback: Check by page ID (replace 123 with your actual my-account page ID)
? ? ? ? if (is_page(6487)) {
? ? ? ? ? ? return true;
? ? ? ? }
? ? ? ? return false;
? ? }
? ? /**
? ? ?* Check if there is a login attempt.
? ? ?*
? ? ?* @return bool
? ? ?*/
? ? private function is_login_attempt() {
? ? ? ? return isset($_POST['log']) && isset($_POST['pwd']);
? ? }Hi
Yes I understand. I couldn’t completely remove it, else login didn’t work anymore. Any chance to get some kind of code into the plugin to make it a setting? for people who don’t need the payment option and only set the cookie when logging in.
Hi. Well there is no error. It’s just that when wp_rtcl_session cookie is set, edge cache will be by passed. When I remove that session it will get a cache hit.
I have removed the function setcookie() in SessionHandler.php, that makes that I get a Cache hit on every page, but unfortunately that leads to a user not being able to loggin anymore.
I could narrow this down a bit more. The problem is, the cookie that is said wp_rtcl_session. I would need a way to deactivate this.
thanks! That was it. I didn’t check there.
great. Will look out for it.
unfortunately it’s not that fancy ?? I have just added some comments to your code to disable the logging.
thanks. I have actually used a different slider, so problem solved. But maybe for future reference you could paste the required CSS Code.