How to open hyperlinks in a new tab

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
6 Likes