Plugin to make signup modal pop up at a route

(will) #1

So I’m trying to figure out how to make the signup modal pop up if I use a special url.


but I’m having trouble wrapping my head around Discourse’s Ember implementation.

I tried doing something like



on the js console but no dice.

Any ideas?

(Robin Ward) #3

Using hash urls rather than Ember’s routes is a little tricky because you’ll probably find that ember strips them off when you request a URL.

All modals currently come out of our router, so you can call {{action showCreateAccount}} in any template or this.send('showCreateAccount') in any controller or route.

If you want to do it via the console, you’ll have to use the container:


Note that that API is ugly for a reason. You’re really supposed to do everything within the app itself and not via the container. But it’s useful for debug purposes.

(will) #4

Thanks @eviltrout so I would have to use the url

That works just fine.

So here is what im trying to accomplish:

  1. I’d like to make a link that is

  2. launch the signup modal over the normal home page.

  3. I’d like it be a plugin so I don’t have to touch core code

How would I do that?


(Robin Ward) #5

It’s a bit tricky if it’s your first plugin but here’s how you’d do it.

(function() {

  Discourse.Route.buildRoutes(function() {
    this.route('signup', {path: '/signup'});

  Discourse.SignupRoute = Discourse.Route.extend({
    beforeModel: function() {
      this.transitionTo('list.latest').then(function(e) { {


The above code registers a route at /signup. When it’s requested, it redirects to list.latest to show the latest topics list and then once that is loaded it pops up the create account modal.

edit: Thanks to @zogstrip I fixed what I previously wrote didn’t work:

Then your plugin.rb should look like this so there is a server side route for signup that works correctly.

# name: signup
# about: /signup plugin for Discourse
# version: 0.1
# authors: williscool


after_initialize do
  Discourse::Application.routes.prepend do
    get 'signup' => 'list#latest'

(will) #6


Thanks so much @eviltrout !


(Kane York) #7

This is actually in core already:

Discourse Meta (login page)
Discourse Meta (local account create page)

(will) #8

That came out 2 days after I did my last release with v.

But thanks for the heads up. I need to add the oauth buttons to the signup anyway so I’ll just update to use core stuff.

(will) #9


Took me forever and a day to figure out how to properly launch the modal dialog.


Can I use this plugin to have a modal window instead of default landing page (in which a paging comes and says “An account is required. Please create an account or log in to continue.”, when the website is limited to registered users)

(Sydney Chiu) #11

Thanks man! all I need! saved my life! BTW if I wanted login modal should I just replace ’ showCreateAccount ’ to ’ showlogin ’ ??