The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
UserCP email options database locations
I have searched thru the code, and searched through phpmyadmin in the database, and I dont understand where the usercp options for things like 'Receive Email from Administrators' and
'Receive Friendship Request Email' checkbox data is stored. I thought I found it under 'users', 'options' in the database, but it was just a set of numbers that I couldnt resolve to meaning anything. If that was the place, is there a list of the codes somewhere out here that would show me what to change those numbers to if I wanted to change the settings via query? Or if that isnt the place, someone smak me in the head and show me how dense I have become in not seeing it. Thanks. |
#2
|
|||
|
|||
and what are you trying to change to do with these
|
#3
|
|||
|
|||
I have an sql query in another area that I wish to use for automatic changing of certain checkboxes in usercp such as admin emails, subscription notifications, etc.
And I have looked and looked and cant for the life of me find the exact database location for certain settings such as these. Or I have gone blind and cant find the haystack with the needle in it. |
#4
|
|||
|
|||
The options column of the user table is a bit field - if you were to write the value in binary, each 0 or 1 would indicate the state of a setting. To change them with a query, you would add or subtract out the value for that option (after making sure the option isn't already in the state you want). For example, to set "Receive Admin Emails" to Yes for everyone who doesn't have it set already, you could do this:
Code:
UPDATE user SET options = options + 16 WHERE NOT (options & 16) and to set it to no, Code:
UPDATE user SET options = options - 16 WHERE options & 16 So the next question is, where does the mask value (16) come from? They are defined in the file includes/xml/bitfield_vbulletin.xml. For the user options field, search for <group name="useroptions">. The values (in base 10) might look like random numbers, but in binary they each have only one bit set. You still have to figure out which ones correspond to which options, but hopefully most are obvious, or else you might be able to figure it out by comparing the name in the xml file to the html name attribute of the <input> tag on a page where that option is set. |
#5
|
|||
|
|||
Thank you.
Sincerely |
#6
|
|||
|
|||
Another thing I didn't mention - if you're writing code to set the options, you should use the values that get read in from the xml file instead of hard-coding numbers. For example, $vbulletin->bf_misc_useroptions['adminemail'] would be set to 16.
|
#7
|
|||
|
|||
Quote:
I am thinking I need to do an if/else...or just an if... If... State is off, set to on or vs/vs |
#8
|
|||
|
|||
Yeah, well, I should probably have stressed that you need to do the check if you're going to set/reset the bits using addition and subtraction, because it may be tempting to think that since you want to set it for everyone, you could just remove the WHERE. But if you do that it won't work and it will affect other options. There are "bitwise" operators that you could use to set/reset bits with no check and without affecting any other options, but the reason my example didn't use those is because I copied those queries from the Automatic Query section of Maintenance > Execute SQL Query in the admincp, and I didn't want to suggest that you could do it a different way unless I tested it (and I'm kind of a novice level SQL person).
|
#9
|
|||
|
|||
Quote:
Oh, I guess I didn't really answer this - sounds like you figured out that it's because of the add/subtract. So I guess the answer to your question is that the check is taken care of in those queries by the WHERE clause, so you don't need to add any other check. Maybe I made it more confusing by mentioning that, but like I said above, I was concerned that you might have decided the WHERE wasn't needed. |
#10
|
|||
|
|||
Well I know I am not the sql wizzard,.. I should have seen that.
Thanks again. (tried to like, but vborg says I liked you too much lol) |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|