Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Trouble adding a preference
I am trying to add a user preference in an extension. I added it as:
and I make use of it like this (in a Render function):
However, the Render function gives me the following error:
And indeed, when I take a look in the database, there is no 'HideStickies' entry in the string in the Preferences column of the User table, not even when I have checked the preference in the Account- forum options page.
Is there anything I have forgotton to add this new user preference?
if ($Context->SelfUrl == 'account.php' && $Context->Session->UserID > 0) {
$PostBackAction = ForceIncomingString('PostBackAction', '');
if ($PostBackAction == 'Functionality') {
function PreferencesForm_HideStickiesPreference(&$PreferencesForm) {
$PreferencesForm->AddPreference('DiscussionIndex', 'HideStickies', 'HideStickies', 0);
}
$Context->AddToDelegate('PreferencesForm',
'Constructor',
'PreferencesForm_HideStickiesPreference');
}
}
and I make use of it like this (in a Render function):
echo '<script type="text/javascript">';
if ($this->Context->Session->UserID >0) {
if ($this->Context->Session->User->Preferences['HideStickies']) {
echo 'startHideStickies();';
}
}
else {
echo 'startShowStickies();';
}
echo '</script>';
However, the Render function gives me the following error:
<b>Notice</b>: Undefined index: HideStickies in ...
And indeed, when I take a look in the database, there is no 'HideStickies' entry in the string in the Preferences column of the User table, not even when I have checked the preference in the Account- forum options page.
Is there anything I have forgotton to add this new user preference?
0