This thread spoke about directly links embedded:
I’m referring to links using hyperlink button:
[Google Test](http://www.google.com)
How do I get this to open in a new tab?
The discussion addresses how to open hyperlinks in a new tab in Discourse. RBoy asks about making links created with the hyperlink button open in a new tab. codinghorror suggests adjusting user preferences, which works per user. RBoy clarifies that the admin setting default other external links in new tab only applies to new users, not existing ones. elijah confirms this and hutchinsfairy provides an SQL solution for bulk updating existing users, advising caution and recommending a backup and using the Data Explorer plugin to preview affected users.
This thread spoke about directly links embedded:
I’m referring to links using hyperlink button:
[Google Test](http://www.google.com)
How do I get this to open in a new tab?
Change your user preference for this and reload the page, then click on it?
Yep that works at the individual user, would that setting also work through the Admin interface for all users (default other external links in new tab) or would each user go and set that setting?
Hmm I think I see what happened, since I already had an account, changing the setting through the Admin interface didn’t make a difference. So I’m assuming that when a new user signs up s/he will automatically have that setting enabled, but changing this admin setting doesn’t reset existing users settings. Am I correct?
Yes, site default settings get applied at account creation time. Get your important ones set up early.
If you already have a tonne of users to update and have console access then you can run an SQL update against the database as below. Please create and download a backup first.
cd /var/discourse/
./launcher enter app
su discourse
psql
UPDATE USER_OPTIONS
SET EXTERNAL_LINKS_IN_NEW_TAB = 't'
WHERE USER_ID <> -1
AND EXTERNAL_LINKS_IN_NEW_TAB = 'f';
\q
exit
exit
Also be aware that this will affect users who may have actually chosen not to use external links. If you wanted to see who it would affect before running it then I would install the Data Explorer plugin and use the following query:
SELECT u.ID "User ID"
,u.USERNAME "Username"
,u.NAME "Name"
,CASE uo.EXTERNAL_LINKS_IN_NEW_TAB
WHEN 't' THEN 'True'
WHEN 'f' THEN 'False'
ELSE 'Not set'
END "External links?"
FROM USERS u
LEFT OUTER JOIN USER_OPTIONS uo
ON u.ID = uo.USER_ID
WHERE uo.EXTERNAL_LINKS_IN_NEW_TAB = 'f'
AND u.ID <> -1