TinyPortal
Development => Support => Topic started by: Alka-Seltzer on September 25, 2008, 06:39:11 AM
Using the scriptbox, I would like to have some links that show to everyone and some links that only show to those who are logged in. How would I do this?
Unless you're just adamant about placing the links in the exact same block, you could make two blocks where only logged in members can view the second block of links.
Assuming that is not the case, and that you want to code the block in php, you will need something among the lines of:
echo 'public link 1';
echo 'public link 2';
if($context['user']['is_logged'])
{
echo 'member link 1 here';
echo 'member link 2 here';
}
This will only output the link if the member is logged.
Just to add a little info. Since you suggested that you wanted to use a scriptbox. You can't do what Ianedres suggested in a scriptbox. Only a phpbox block type will do this kind of check.
Quote from: Ianedres on September 25, 2008, 07:25:07 AM
Unless you're just adamant about placing the links in the exact same block, you could make two blocks where only logged in members can view the second block of links.
Assuming that is not the case, and that you want to code the block in php, you will need something among the lines of:
echo 'public link 1';
echo 'public link 2';
if($context['user']['is_logged'])
{
echo 'member link 1 here';
echo 'member link 2 here';
}
This will only output the link if the member is logged.
Thanks, will give it a try.
Quote from: IchBinâ,,¢ on September 25, 2008, 02:42:51 PM
Just to add a little info. Since you suggested that you wanted to use a scriptbox. You can't do what Ianedres suggested in a scriptbox. Only a phpbox block type will do this kind of check.
Thanks for that heads up.
Worked just fine, thanks guys. :)