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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-27-2012, 04:01 PM
DetroitYES's Avatar
DetroitYES DetroitYES is offline
 
Join Date: Mar 2009
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Update options outside of the settings menu?

I found this thread:

https://vborg.vbsupport.ru/showthread.php?t=157223

Which lead me to develop this code in my admincp for the product:

PHP Code:
//...
$db->query_first("UPDATE " TABLE_PREFIX "setting SET " TABLE_PREFIX "setting.value = ".$_REQUEST['userid']." WHERE " TABLE_PREFIX "setting.varname = 'atdisg_featured_feed'");
print_cp_message('Featured user was updated successfully.''atdisg_admin.php?do=user_tracker');
//... 
This executes correctly, and if I go to the option under the settings menu, displays the updated value correctly. However, I also have this code that generates a diffrent button if the id of the user being displayed for the row matches the setting. It only works correctly when I update the option via the settings menu, not via the query. In other words, $vbulletin->options['atdisg_featured_feed'] does not seem to be pulling from the database...

PHP Code:

            
if ($row['userid'] == $vbulletin->options['atdisg_featured_feed']) {
                
$set_unset_featured "<input style='border:2px solid #FF0000; cursor:pointer;' type=\"button\" class=\"button\" onclick=\"window.location.href = 'atdisg_admin.php?do=set_featured_user&userid=".$row['userid']."';\" value=\"Stop Featuring\">";
            } else {
                
$set_unset_featured "<input style='border:2px solid #00AA00; cursor:pointer;' type=\"button\" class=\"button\" onclick=\"window.location.href = 'atdisg_admin.php?do=set_featured_user&userid=".$row['userid']."';\" value=\"Set As Feature\">";
            } 
I have to assume this is due to the datastore Paul mentioned in the related thread:

Quote:
Originally Posted by Paul M View Post
They are stored as a serialized array in the datastore for general access, and ultimately, in the settings table.
Is there a way to update the datastore as well when I run the query?.. Or is there some reason that I should not update the options outside of settings?

--------------- Added [DATE]1343410605[/DATE] at [TIME]1343410605[/TIME] ---------------

#############UPDATE

i found the save_settings() function, on line ~430 of adminfunctions_options.php

PHP Code:
 /**
* Updates the setting table based on data passed in then rebuilds the datastore.
* Only entries in the array are updated (allows partial updates).
*@param    array    Array of settings. Format: [setting_name] = new_value
*/
function save_settings($settings)
{
//... 
Reply With Quote
Благодарность от:
Sarteck
 


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 04:34 AM.


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.05854 seconds
  • Memory Usage 2,328KB
  • Queries Executed 12 (?)
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
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (1)post_thanks_box_bit
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • 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_threaded
  • showthread_threaded_construct_link
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • 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