Jump to content

Add Membership Logout Button

Recommended Posts

Hello, 

I would like to add a button that allows members to easily log out of Squarespace. This is mainly needed because Squarespace has recently changed the "Account" tab so that the "Sign Out" button is less obvious. The users of this site are the folks that want to sign out after each use. 

I'd like to add a sign out button to the header. 

Is there a way to do this?

Link to comment
16 hours ago, jholmertz said:

I would like to add a button that allows members to easily log out of Squarespace. This is mainly needed because Squarespace has recently changed the "Account" tab so that the "Sign Out" button is less obvious.

Can you give some more context and a link to the site?

Unless the login is protecting sensitive information that must be protected for security or compliance reasons, it is standard practice to place a 'logout' option within a user profile, rather than giving it dedicated space in the header.

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Would you like your customers to be able to mark their favourite products in your Squarespace store?

Link to comment

Link

I understand your points. However, a large demographic of the site members are older and see logging out as necessary. These are the folks logging in and out of Facebook on their desktop computers, for example. Not having a prominent logout button is a significant issue for using Squarespace. 

Link to comment
  • 1 month later...
  • 3 months later...

1) Members basically lose access to the entire rest of the website, unless they add a page link for each other place (where did the menu go)?  Why would you take away the navigation menu from the members part of the site?)
2) The sigout button (which helps find a way to get around #1) is hidden in teensy font inside the 'account' menu.  not super obvious.

I wouldn't mind being able to create a logout button either

 

Link to comment
  • 4 weeks later...
  • 1 month later...
  • 4 weeks later...

Good news @jholmertz @JessEds  @Benjohnson31 @OliviaPeddinghaus @hoardingacademy @OSTS @CheekyStar , I've developed a straightforward solution that allows to place a logout button anywhere on your website.

  1. Simply add the following code snippet to the Code Injection FOOTER
  2. Ensure your logout button/link redirects to #signout - See attachment
<script>
  document.addEventListener("click", (e) => {
    if (e.target.tagName === "A" && e.target.getAttribute("href") === "#signout") {
      e.preventDefault();
      const i = document.createElement("iframe");
      i.src = window.location.origin + "/account/frame";
      i.width = "1";
      i.height = "1";
      document.body.appendChild(i);
      i.onload = () => {
        let t = setInterval(() => {
          let b = i.contentDocument.querySelector('button[data-test="sign-out"]');
          if (b) {
            clearInterval(t);
            b.click();
          }
        }, 100);
      };
    }
  });
</script>

custom-signout-button.png

Feel free to DM me if you need a more advanced solution, such as programmatically toggling log in and log out buttons.

Edited by heyawaiszahid
Link to comment
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.