The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How does one query based on the admin email field?
I am attempting to write a script to send out emails to users automatically but I need to be sure and respect all opt-out requests (users who have unchecked "receive emails from the administrator"). Given that this field uses vbulletins binary coding system how would I run a query to see if it is selected or not on a per user basis? Thanks.
|
#2
|
||||
|
||||
The same way you would be querieing any other bitfield too ...
[sql]SELECT username, email FROM user WHERE options & 16[/sql] give you all users who have set adminemail=yes |
#3
|
|||
|
|||
Thanks.
|
#4
|
|||
|
|||
What if I want to use an if statement that states if set to receive yes if not, then no.
I don't want all users I just need to determine if one user has opted out. (patched vb 3.0.6) Thanks |
#5
|
|||
|
|||
If it's just one user you're wondering about, just look at the individual's info in AdminCP.
|
#6
|
|||
|
|||
I'm automating this.... it's not that simple. I'm not stupid. Of course I know I can look.
|
#7
|
||||
|
||||
Quote:
|
#8
|
|||
|
|||
I'm sending automated mail to a single user. I want a basic statement that verifies if they are set to receie admin emails. Similar to this:
PHP Code:
If I use a where clause with the options & 16 then the query will obviously return no results if the user has opted out. This will result in no recipient. Which would mean no mail is not sent. But I'm not sure that's the best way to go about this. It seems messy. |
#9
|
||||
|
||||
You can can in mySQL or PHP by check verifying that options & 16 isn't 0.
If it is Zero, the Option is not set. Where you are doing the check doesn't matter much. |
#10
|
|||
|
|||
Okay I sorted it by checking results. For anyone else wondering here's what I used.
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|