Setting defaults to enable mailing list mode-Temporary Solution

Continuing the discussion from Edit a user setting for all Discourse users:

So, I did this in my forum - I sent a nice email explaining what’s up, and just did it.

Then, I went ahead and set the defaults as I wanted to be checked by default - and have instructions telling people how they can change them if they want (all I did was set defaults, not lock them in place)

It’s been great. Discourse is now the mailing list I’ve wanted since day one, with the most functional web-ui out there.

Here’s how I did it, I sure hope I didn’t break anything horribly wrong, and am posting here to ensure that fact.

First, ssh in to your host as root.

cd /var/discourse/

./launcher ssh app

su postgres


\c discourse
alter table only users alter column email_always set default true;
alter table only users alter column mailing_list_mode set default true;

This error is expected: could not save history to file "/var/lib/postgresql/.psql_history": No such file or directory

exit  (to get out of the docker image)
exit  (to get out of the host)


At this point, I tell people that this is a mailing list, with the option to go web-only if they want.

Thank you discourse, for being awesome.


I don’t know how risky it is to change the default values in the DB. It doesn’t seem terribly dangerous to me, but I’m not sure.

Any comment on this @sam?

1 Like

It should be fine, does not sound terribly risky but may eventually break if we refactor schema.

1 Like

Well, at that point, anything else that @watchmanmonitor could have possibly done would break too, so I think this is a good solution :slight_smile:


Ha ha ha ha ha. So true.

I’m just doing what i have to til this cow comes home:

1 Like

Is there a reason I wouldn’t include this in an exec custom command in app.yml?

- exec: sudo -u postgres psql -d discourse -c "alter table only users alter column email_private_messages set default false;"
1 Like

There are two:

  • I didn’t know you could do that.
  • This is a one time, ever, action, so I wouldn’t want it to be done on every rebuild
    (or whatever docker process which might call that command)

Well, you might, if the rebuild changed it back…

1 Like

That was my thinking, that and that automating it will make my life easier.

1 Like

I wonder, as we move another database from self hosted to Discourse hosted, what is the best plan to ensure our users start out in Mailing list mode?

The problem there is that the ability to do low level things like this is taken away when you move to external hosting. Internal and external hosting both come with pros and cons but to sum it up, its an inverse relationship between your ability to do things vs your potential to break things.

1 Like

Right, I’m tired of the ability to break things, which is why I’mi bringing more of the discourse I manage to their hosting. In this case, I need this default set, and I believe that having a one-liner such as this in our app.yml would be compatible with discourse hosting.

This is absolutely beautiful. Thank you VERY much Allen.

1 Like

For anyone following along… I’m leaning towards the use of auto-watched categories, as I feel the ability to unwatch any given topic puts more fine grained controls into the hands of the user.

This idea:

Combined with links in the footer:

would be really nice.

The links in the footer may have to be plugin material, as the last time I heard, at least @sam was not fond of putting lots of links in emails.

So the current manual way to set the person to watching is to impersonate the individual and set their category option to Watching, correct? You set this to the right on New Topic in the second nav bar at the top.

I suppose you could impersonate each new user, after you invite them, after they accept, and add category(ies) to their watch list for them, yes.

I know I need it added automatically, because I won’t be able to do it consistently.

I’m not sure I follow this comment… what did you have in mind about a New Topic?

I was just noting the location of where to set Watching, as opposed to somewhere in the Admin area.

I am asking if this is the correct way to do this now, or is there a global command. Since our site is a Discourse Hosted site, we can’t make the changes as you noted in the OP.

1 Like

A global email defaults setup is a common request, you can add your vote here:

So, now it’s time to undo these defaults. because it’s in the admin now.

I wonder if there’s any way to compare the current running schema vs the discourse-supported one?