Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 15 Apr 2013, 23:31
smirkley smirkley is offline
 
Join Date: Apr 2008
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.
Reply With Quote
  #2  
Old 16 Apr 2013, 04:26
ForceHSS's Avatar
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
and what are you trying to change to do with these
Reply With Quote
  #3  
Old 16 Apr 2013, 14:37
smirkley smirkley is offline
 
Join Date: Apr 2008
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.
Reply With Quote
  #4  
Old 16 Apr 2013, 15:13
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


and to set it to no,

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


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.
Reply With Quote
  #5  
Old 17 Apr 2013, 00:38
smirkley smirkley is offline
 
Join Date: Apr 2008
Thank you.

Sincerely
Reply With Quote
  #6  
Old 17 Apr 2013, 11:17
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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.
Reply With Quote
  #7  
Old 18 Apr 2013, 13:45
smirkley smirkley is offline
 
Join Date: Apr 2008
Originally Posted by kh99 View Post
....(after making sure the option isn't already in the state you want).
Because this sounds like to me that you are saying I need to verify the state first before modifying the state (if I understand what you are saying, it is because you are adding/subtracting data values from a sum), do you have a recommended method?

I am thinking I need to do an if/else...or just an if...


If...

State is off, set to on


or vs/vs
Reply With Quote
  #8  
Old 18 Apr 2013, 15:05
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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).
Reply With Quote
  #9  
Old 18 Apr 2013, 15:06
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by smirkley View Post
Because this sounds like to me that you are saying I need to verify the state first before modifying the state (if I understand what you are saying, it is because you are adding/subtracting data values from a sum), do you have a recommended method?

I am thinking I need to do an if/else...or just an if...


If...

State is off, set to on


or vs/vs

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.
Reply With Quote
  #10  
Old 18 Apr 2013, 16:16
smirkley smirkley is offline
 
Join Date: Apr 2008
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)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 04:04.

Layout Options | Width: Wide Color: