How do I create a new Sign Up / Login Button?

AI-generated summary

hyphalos is trying to create a custom “Login to RSVP” button using JavaScript, in conjunction with the Discourse Events plugin. However, they are having trouble redirecting users back to the original page after login. They’ve tried using the /login path, which doesn’t work, and the api.decorateWidget method, which seems to conflict with the Events plugin. hyphalos wonders if using createWidget() instead might be a solution. They’ve also considered passing the current window as a referer to redirect users back after Single Sign-On (SSO). hyphalos asks if anyone else has successfully recreated the Sign Up/Login button elsewhere on their Discourse site.

Hey Discourse team,

I was looking to create a Login to RSVP button in conjuction with this awesome Events plugin created by pavilion:
https://github.com/paviliondev/discourse-events

I managed to create the button with JS:

I’m having trouble creating a Sign Up / Login path from here. The goal was to create a Sign Up / Login button that redirects them back to the page they came from.

I’ve tried:

  1. /login but that does not redirect the user back to the Topic
  2. When I attemped this api.decorateWidget fix (which has great instructions btw! Kudos :slight_smile: )
    Developing Discourse Themes & Theme Components

Whenever I would declare topic-title:before or topic-title:after as the NAME:LOCATION, the helper doesn’t post it anywhere on the screen, I’m guessing this might be in conflict with the events plugin? It works with header-buttons:before

Another thing I was thinking if it’s possible is to just forward the current window as a referer so it redirects back after SSO

Any thoughts?

Cheers!

I found some similar issue posted but those seemed to want to create the login button after posts, I was just hoping to add it near the title. Would I have to actually do createWidget() instead?

Has anyone else tried to re-create the Sign Up / Login button elsewhere on their Discourse site?