Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
727 views
in Q2A Core by

2 Answers

+1 vote
by
selected by
 
Best answer

 I'm assuming you meant via SQL.  I added three users in addition to admin. 

I unsubscribed one, ran select * from qa_users, then unsubscribed another and checked the query results again and the same for the third user and from what I can tell, records (users) that are unsubscribed will be found by using:

SELECT * FROM `qa_users` WHERE flags = 33

by
Thanks.....!
by
This is actually returning users who don't want to receive emails AND are confirmed:

    define('QA_USER_FLAGS_EMAIL_CONFIRMED', 1);
    define('QA_USER_FLAGS_USER_BLOCKED', 2);
    define('QA_USER_FLAGS_SHOW_AVATAR', 4);
    define('QA_USER_FLAGS_SHOW_GRAVATAR', 8);
    define('QA_USER_FLAGS_NO_MESSAGES', 16);
    define('QA_USER_FLAGS_NO_MAILINGS', 32);
    define('QA_USER_FLAGS_WELCOME_NOTICE', 64);
    define('QA_USER_FLAGS_MUST_CONFIRM', 128);
    define('QA_USER_FLAGS_NO_WALL_POSTS', 256);
    define('QA_USER_FLAGS_MUST_APPROVE', 512);

Bear in mind that it is also assuming all other flags off, which means users should not be blocked, they haven't selected an avatar, they haven't selected a gravatar, etc.
+3 votes
by

Flags is a bit field. Which means you need to query using the bitwise operators. The bit that controls this behaviour is bit 32 (the specific flag is QA_USER_FLAGS_NO_MAILINGS). If it has a 1 then the user does not receive emails. If it has a 0 the user receives emails.

So to find all these users you need to check the users that have that flag (without caring about the rest) set to 1:

SELECT * FROM qa_users WHERE flags & 32 > 0

by
Thanks.....! This helped me a lot.
...