Take "Receive news and updates from us by email" value from the database

MTBeros

Member
Hi there!

I use an external email marketing tool and I must export newly registered users periodically so, where can I take the "Receive news and updates from us by email" value from the database to send them the newsletter? Is this the correct field to take?

Later, if a user unsubscribes from the newsletter, how can I update this value on Xenforo's database?

Thank you!
 

Kruzya

Well-known member
You can just perform JOIN.
Query like this should help you:
SQL:
SELECT xf_user.email
FROM xf_user
  INNER JOIN xf_user_option ON xf_user.user_id = xf_user_option.user_id
WHERE xf_user_option.receive_admin_email = 1
 

MTBeros

Member
You can just perform JOIN.
Query like this should help you:
SQL:
SELECT xf_user.email
FROM xf_user
  INNER JOIN xf_user_option ON xf_user.user_id = xf_user_option.user_id
WHERE xf_user_option.receive_admin_email = 1
Thank you a lot! I have no idea about SQL and it helps me 😃
 
Top