WordPress.org

Ready to get started?Download WordPress

Forums

Creating a logout button (13 posts)

  1. lesfitz
    Member
    Posted 2 years ago #

    Hi. I should start by saying I Am a true novice here. I am managing the content of a website that has a secure login page that has already been created. I am trying to figure out how to add a logout button on that page once the user is logged in. Currently, there is a login button on the main menu so those with logins are the only ones who can access that area of the website (the rest is open to anyone). I Can't seem to figure out through my websearches how to add a logout button once on the page. any help is much appreciated!

  2. Johnb81
    Member
    Posted 2 years ago #

    Are you using the WordPress login to login to the wp-admin? If that is the case, once logged in to the WordPress dashboard there is a logout button in the top right corner of the screen.

    Simply move the mouse on the user and a drop down menu will appear with logout.

  3. lesfitz
    Member
    Posted 2 years ago #

    THanks for your quick reply, JOhn. Once the user is logged in (via the wp page), it takes the user to the secure page of our website and one no longer sees any wordpress info (it just looks like all of our other pages at that point). any ideas?

  4. Johnb81
    Member
    Posted 2 years ago #

  5. lesfitz
    Member
    Posted 2 years ago #

    THANks. so where on my dashboard would i go to add this? and would it automatically add a logout button then? Thank you so much...i wasn't kidding when i said i was a novice, eh? :)

  6. Johnb81
    Member
    Posted 2 years ago #

    Don't worry about being a novice :) Everyone here started from there.

    In your case you cannot simply add it in the dashboard, you have to add it in the source code of the pages where there is no logout button.

  7. lesfitz
    Member
    Posted 2 years ago #

    THank you--you are so kind. So I have been trying to do this and the best I can get it to do is show "logout" in the visual of the page on my dashboard but then it wont show up when i try to update/publish the page...thoughts?

  8. Johnb81
    Member
    Posted 2 years ago #

    Since it is code you have to add it in the HTML code when editing a page not in the visual.

  9. lesfitz
    Member
    Posted 2 years ago #

    Hi there. Another question. I have FINALLY figured out how to get the logout button added (yay!) and I have been successful in getting the user to redirect to the home page when one presses the logout. However, they can still go back to secure login page without logging in. So I am thinking there must be an additional code I need to add that requires the cookies to be deleted maybe? Thoughts? Thanks.

  10. Johnb81
    Member
    Posted 2 years ago #

    It is not about deleting the cookie. When you logout from a web application you might still have the cookie, but the session from the web application site would have been closed.

    In your case it seems that the logout action / procedure is not properly implemented and that's why the user is still able to go back to the secure area.

  11. lesfitz
    Member
    Posted 2 years ago #

    Thanks for all of your help. I can not figure out what I am missing here...any other suggestions for what to try? Also, sort of separately, when I was able to at least add the logout button, the login button still showed up...so confusing. I wonder--do you know of a resource line for who I could call to talk this through?
    thanks very much.

  12. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    Yes, I have this running here (Please read and understand each line in this prior to attempting.)

    Code does NOT require the theme (see last part).

  13. lesfitz
    Member
    Posted 1 year ago #

    Hi--thank you so much for trying to help me. I don't understand what I need to do here. I am a COMPLETE NOVICE and am just trying to add this one little piece. we have a login that was set up but no logout, so once a person logs into the secure page, the login button still shows as login and there is no place to logout. I would like to figure out how to change the main login button (currently on our fixed menu) so that once one logs in, the button changes to say logout so that folks log out (and, once they leave that page, whether they log out or not, are required to log in again to access the info). thanks again for your help.

Topic Closed

This topic has been closed to new replies.

About this Topic