Run report of digest Unsubscribes


(James Mc Mahon) #1

Is there a way I can run a report on which users have unsubscribed from the Discourse digest for my site?

I’d like to flag them elsewhere (ActiveCampaign) too so that they don’t have to unsubscribe in to places. Or get pi$$ed at us because they thought they were opting out of everything.


(Sam Saffron) #2
./launcher enter app
rails c
[7] pry(main)> UserOption.where(email_digests: false).references(:user).includes(:user).pluck(:email)

(TomG) #3

If you’re doing this often then you could install the Data Explorer plugin and use 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?"
        ,CASE uo.mailing_list_mode 
          WHEN 't' THEN 'True' 
          WHEN 'f' THEN 'False' 
          ELSE 'Not set' 
        END        "Mailing List Mode?"
        ,CASE uo.email_digests 
          WHEN 't' THEN 'True' 
          WHEN 'f' THEN 'False' 
          ELSE 'Not set' 
        END        "Email Digests?"
        ,digest_after_minutes/60 || ' Hours' "Digest Every"
FROM   USERS u 
       LEFT OUTER JOIN USER_OPTIONS uo 
                    ON u.ID = uo.USER_ID 
WHERE  uo.email_digests = 'f' 
   AND u.ID <> -1

(James Mc Mahon) #4

Thanks guys! I thought I had the data explorer plugin installed… looks like I don’t so I’ll have to get that done…