Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

how do i call a user option from index template?

Aloittaja SleePy, helmikuu 21, 2006, 10:35:19 IP

« edellinen - seuraava »

SleePy

i run a random banner code on our site and want to give options because some people are having trouble with it.
everything is good :) i was able to add a drop down to profile with options. but now i can't seem to get it to find it.


if(empty($context['user']['options']['randombanner'])) {$context['user']['options']['randombanner'] = '1';}
if($context['user']['options']['randombanner'] == 1){echo '<img src="/forums/banners/index.php" height="200" width="800" />';}
elseif($context['user']['options']['randombanner'] == 2){$randomnumber = rand(1, 8); echo '<img src="/forums/banners/banner'.$randomnumber.'.jpg" height="200" width="800" />';}
elseif($context['user']['options']['randombanner'] == 3){echo '<img src="/forums/banners/banner1.jpg" height="200" width="800" />';}


i have it set to 2 or 3 in my profile and 3 is to show a default image. but go to any other page than profile and i instantly lose it and it reverts back to 1. meaning to me it can't find $context['user']['options']['randombanner']
i tried
$context['member']['options']['randombanner']
$options['randombanner']
$settings['randombanner']
and nothing is working... I don't understand why it isn't working
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Dannii

It's probably going to be in $user_info
you're saving this setting in the members table? Just look where you have loaded it from the database and that will tell you exactly where.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

SleePy

well i think its stored in the themes table because this is how i did the settings in profile template


</tr><tr><td><b>Random Banner: </b></td> <td><select name="default_options[randombanner]" ><option value="1"'; if($context['member']['options']['randombanner'] == 1){echo ' selected="selected"';}echo'>Normal </option><option value="2"'; if($context['member']['options']['randombanner'] == 2){echo ' selected="selected"';}echo'>Dial Up</option><option value="3"'; if($context['member']['options']['randombanner'] == 3){echo ' selected="selected"';}echo'>No Random</option></select> - If "No Random is selected a default one will be used instead.</td>


btw. how can i do a better way of finding if the option is selected? i tried using the one that is used on smilies set but couldn't get it to work.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Advertisement: