Warm tip: This article is reproduced from stackoverflow.com, please click
logout php prestashop prestashop-1.7

Log out all customers from Prestashop

发布于 2020-05-08 06:22:53

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.

Questioner
Anis R.
Viewed
38
Mahdi Shad 2020-02-23 02:32

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.