Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2013, 10:31 PM
smirkley smirkley is offline
 
Join Date: Apr 2008
Posts: 627
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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 04-16-2013, 03:26 AM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

and what are you trying to change to do with these
Reply With Quote
  #3  
Old 04-16-2013, 01:37 PM
smirkley smirkley is offline
 
Join Date: Apr 2008
Posts: 627
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 04-16-2013, 02:13 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 04-16-2013, 11:38 PM
smirkley smirkley is offline
 
Join Date: Apr 2008
Posts: 627
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you.

Sincerely
Reply With Quote
  #6  
Old 04-17-2013, 10:17 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 04-18-2013, 12:45 PM
smirkley smirkley is offline
 
Join Date: Apr 2008
Posts: 627
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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 04-18-2013, 02:05 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 04-18-2013, 02:06 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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 04-18-2013, 03:16 PM
smirkley smirkley is offline
 
Join Date: Apr 2008
Posts: 627
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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


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

Forum Jump


All times are GMT. The time now is 09:47 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04793 seconds
  • Memory Usage 2,249KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete