0

As a admin in admin panel I want to change status of user account to inactive and after that user should be logged-out from frontend area if he is logged-in. How can I programatically log-out other front-end user by admin from admin panel?

1 Answer 1

1

You can get the session save path from app/etc/env.php file.

'session' => [
    'save' => 'files'
],

Here, in above code if save_path key is defined, then it will be session path or else you can get it from printing phpinfo() and look for session.save_path

Now what you can do is read all the files contents in that path via PHP code and look for customer_base -> customer_id parameter in that file.

If this customer id matches with your condition, then delete that file programmatically via PHP code in your magento backend.

Note that the content of session file is not simply in serialize format. It is collection of serialize format so you need to write a code that parses the value of customer_id accordingly.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.