# É possível fazer o botão "Sign Up" persistir durante a rolagem, em vez do "Log In"?

**URL:** https://meta.discourse.org/t/is-it-possible-to-have-the-sign-up-button-persist-during-scroll-rather-than-the-log-in-one/118116
**Category:** Support
**Created:** [18 Maio , 2019 21:51 UTC](https://meta.discourse.org/t/is-it-possible-to-have-the-sign-up-button-persist-during-scroll-rather-than-the-log-in-one/118116 "2019-05-18T21:51:29Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![zenkamal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zenkamal/32/122448_2.png) [@zenkamal](https://meta.discourse.org/u/zenkamal)
#### Post date: [18 Maio , 2019 21:51 UTC](https://meta.discourse.org/t/is-it-possible-to-have-the-sign-up-button-persist-during-scroll-rather-than-the-log-in-one/118116/1 "2019-05-18T21:51:29Z")

</div>

Most people scrolling down a thread on my site will not have yet signed up.

Thus I’d like them to see the “Sign Up” button when they’re in a thread, rather than the “Log In” button. (even though I know it’s possible to sign up using either button, the “Sign Up” one is more obvious).

Anyone know if that’s possible?

Some (small? medium?) percentage of readers may not realize that there’s a Sign Up button while scrolling, and I’d rather make it super obvious to them. And I figure that those with existing forum accounts would be much more likely to have seen the Log In button before, so the persistance of the Log In button is relatively less useful for them than the persistance of the Sign Up button would be for those without accounts.

---

<div class="post-metadata">

### Author: ![zenkamal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zenkamal/32/122448_2.png) [@zenkamal](https://meta.discourse.org/u/zenkamal)
#### Post date: [20 Maio , 2019 18:09 UTC](https://meta.discourse.org/t/is-it-possible-to-have-the-sign-up-button-persist-during-scroll-rather-than-the-log-in-one/118116/2 "2019-05-20T18:09:01Z")

</div>

Not sure if bumping is okay, but anybody happen to know if the above is possible?

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [20 Maio , 2019 19:06 UTC](https://meta.discourse.org/t/is-it-possible-to-have-the-sign-up-button-persist-during-scroll-rather-than-the-log-in-one/118116/3 "2019-05-20T19:06:15Z")

</div>

It is possible, here’s one way to do it.

You’re essentially replacing our [default header-buttons widget](https://github.com/discourse/discourse/blob/446ec1b44a6299be4e97ca8524001e8787f98594/app/assets/javascripts/discourse/widgets/header.js.es6) and moving `!attrs.topic`. You can add this to a theme in the `header` section (admin \> customize \> themes \> edit CSS/HTML).

```js
<script type="text/discourse-plugin" version="0.8.13">
api.reopenWidget("header-buttons", {
      tagName: "span.header-buttons",

  html(attrs) {
    if (this.currentUser) {
      return;
    }

    const buttons = [];

    if (attrs.canSignUp) {
      buttons.push(
        this.attach("button", {
          label: "sign_up",
          className: "btn-primary btn-small sign-up-button",
          action: "showCreateAccount"
        })
      );
    }

    if (!attrs.topic) {
    buttons.push(
      this.attach("button", {
        label: "log_in",
        className: "btn-primary btn-small login-button",
        action: "showLogin",
        icon: "user"
      })
    );
    }
    
    return buttons;
  }
});
</script>

```

---

<div class="post-metadata">

### Author: ![zenkamal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zenkamal/32/122448_2.png) [@zenkamal](https://meta.discourse.org/u/zenkamal)
#### Post date: [20 Maio , 2019 20:25 UTC](https://meta.discourse.org/t/is-it-possible-to-have-the-sign-up-button-persist-during-scroll-rather-than-the-log-in-one/118116/4 "2019-05-20T20:25:45Z")

</div>

Thanks! You are indeed awesome.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [19 Junho , 2019 20:25 UTC](https://meta.discourse.org/t/is-it-possible-to-have-the-sign-up-button-persist-during-scroll-rather-than-the-log-in-one/118116/5 "2019-06-19T20:25:48Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
