Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor etoilewebdesign

    (@etoilewebdesign)

    Hi Alex,

    Could you please describe in further detail what you are trying to do and what is actually happening?

    For example, are you trying to add a logout link to your menu that redirects users somewhere else once they are logged out?

    Along with a detailed explanation, a link to your site would likely help us see what’s going on.

    Thank you

    Thread Starter alexmattorr

    (@alexmattorr)

    I have the logout shortcode in my header.php. Even if no user has logged in, I get the You have been successfully logged out..

    I read on another thread that the logout code should only be in the area where the user is redirected / has access. So I removed the <?php echo do_shortcode(“[logout]”); ?> from the header.php and moved it to the specific page that the user gets redirected to after they login. Even in this specific page, I still get the You have been successfully logged out..

    All I am trying to do is:

    If the user is not logged in, There is a link in the header where they have a link to the sign in page.

    If the user is logged in, There is the sign out link / button in the header.

    Plugin Contributor etoilewebdesign

    (@etoilewebdesign)

    Hi Alex,

    It sounds like your best option to get exactly what you need would be to use the public function we have made available in our plugin. This would allow you to display different elements in the same area based on whether or not someone is logged in. We have a video explaining this here: https://www.youtube.com/watch?v=bKiJAjq7PhQ.

    Thread Starter alexmattorr

    (@alexmattorr)

    Hi Etolie,

    That worked great and I really appreciate the help.

    I have one more quick question. So now the boolean is checking and works properly now, the only issue is that I am doing: echo do_shortcode(“[logout]”); if the user is logged in, and it displays the You have been successfully logged out. Is there anyway I can just force the logout link with a public function?

    Plugin Contributor etoilewebdesign

    (@etoilewebdesign)

    Hi Alex,

    This is happening because the [logout] shortcode is meant to be used on a page.

    Instead of echo do_shortcode(“[logout]”); could you try inserting a link to a page that has the [logout] shortcode on it? For example:

    <a href="https://url.of.page.with.shortcode">Log Out</a>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Logout shortcode in header’ is closed to new replies.