0

I'm in a situation where I need to logout the current logged_in member without him clicking a logout link. (Javascript click trigger is not an option.)

I'm using the great freemember module (https://github.com/devdemon/freemember/)

How can I call the freemember lougout function directly from PHP in a template ?

0
<php

include PATH_THIRD . 'freemember/libraries/freemember_lib.php';

$free = new Freemember_lib();

$free->logout();

?>

Have you tried something like that? There's is also the load function attached to the EE core, but things like above usually always work for me.

Also, freemember is probably loaded to the core...

<?php ee()->freemember->logout(); ?>

Could work. Also, this seems likely to work as well...

<?php ee()->session->destroy(); ?>
| improve this answer | |
  • code #1 triggers PHP error – laurent Aug 25 '15 at 17:30
  • code #2 does not work unknown property – laurent Aug 25 '15 at 17:30
  • code #3 is spot on ! (just had to add a redirect to make it work completely but that's what I needed, thanks) – laurent Aug 25 '15 at 17:32
  • Awesome! derp, the first example, lulz, I didn't instantiate the class. I'll update it, but you got something working, so success! – jrothafer Aug 25 '15 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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