TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 790
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 703
  • Total: 704
  • tino

Block scriptbox Help

Started by Alka-Seltzer, September 25, 2008, 06:39:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Alka-Seltzer

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?

Ianedres

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.

IchBin

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.

Alka-Seltzer

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.

Alka-Seltzer

Worked just fine, thanks guys. :)

This website is proudly hosted on Crocweb Cloud Website Hosting.