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
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)
{
//...