Ad

Log Out All Customers From Prestashop

- 1 answer

I need a way to log out all signed in customers from my Prestashop site, as a domain name migration caused some issues with user sessions, and having customers sign out and re-sign in is fixing it.

I tried the following code, to no avail:

$customers = Customer::getCustomers();
foreach($customers as $customer) {
    $obj = new Customer($customer['id_customer']);
    $obj->logout();
}

Is there a way to natively invalidate/destroy all user sessions from Prestashop (code or back office)? Otherwise, plain PHP methods are more than welcome.

Ad

Answer

You have to change the Prestashop cookie to avoid validating login.

It's impossible to change the "cookey-key" because of failing all passwords but you can override Cookie class and change cookie pattern.

Ad
source: stackoverflow.com
Ad