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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 134
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 159
  • Total: 159

How To Restrict Guest From Viewing Articles

Started by tribalost, May 08, 2007, 12:47:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tribalost

can anyone please help me with this...
i know its a php code or something but i dunno how to start and i've just started learning php so im cluless...

tnx in advance...

G6Cad

You really dont have to change any code, just remodle the articles a bit.

Create a new category, pick out the membergroups you want to allow to see that category.
That way you reastrict what articles to show for guests if you leave the Guest checkbox empty when they are placed in that category.

tribalost

tnx 4 the quick reply g6 but im not sure where to manage the article category permissions :(

tribalost

nvm i just found out if ($context['user']['is_guest'])
{
   echo
   '<h5>Access Denied</h5>
   We are sorry. You must be registred on the site in order to view this Tool.';
} else  {
code
}


but tnx for the help anyways g6 :)

Xeriar

Quote from: G6â„¢ on May 08, 2007, 01:02:17 PM
Create a new category, pick out the membergroups you want to allow to see that category.
That way you reastrict what articles to show for guests if you leave the Guest checkbox empty when they are placed in that category.

Umm, sorry for the bump but, how do I do this?  I don't see any place where I can restrict articles or article categories by membergroup.

Zetan

You can't currenty "restrict" access to articles with an option.
But as mentioned above, you can grant member groups permissions to view articles.

I have an article category that only one member group knows about, that category has a seperate menu block that has links to those articles. Only the member group with permissions can see it. No other group knows it's there.


IchBin

if you want a work around you can use some php code to do it.

if (!$context['user']['is_guest']){
echo 'all your stuff here';
}


This will only display the article if the user is not a guest.

JOSHSKORN

Quote from: Zetan on May 23, 2007, 11:30:17 AM
You can't currenty "restrict" access to articles with an option.
But as mentioned above, you can grant member groups permissions to view articles.

That's what I found, it's either all or nothing.  You can either view all articles, or you can't.

Quote from: Zetan on May 23, 2007, 11:30:17 AM
I have an article category that only one member group knows about, that category has a seperate menu block that has links to those articles. Only the member group with permissions can see it. No other group knows it's there.
I was thinking about doing this, myself.  My concern is that, someone COULD potentially find the link to the article and have access to it.

Quote from: IchBinâ„¢ on May 24, 2007, 12:17:45 AM
if you want a work around you can use some php code to do it.

if (!$context['user']['is_guest']){
echo 'all your stuff here';
}

This code sounds intriguing.  Two questions of it though.  Lets say my site was www.mysite.com, and I didn't want non clan members to view Article #16 under any circumstances, not by right-clicking and being able to view the source or anything.  Secondly, instead of testing just forum guests, but for all member groups (allowing viewing privileges) beginning with the string "CM" to view the article?  Security of my articles is a big deal to me (see my second comment in response to Zetan's comments), and I want to pretty much know that there's no way possible that someone from the outside can view something.

Can you provide me with code, using the exact link of
http://www.mysite.com/smf/index.php?page=16 ?  I'm not a PHP programmer.

IchBin

You're questions seem a bit vague. But if you don't want to show an article to anyone unless they're a member of your clan group then you can change this code to do it.
Change the number 3 to the number the corresponds to your group number in your forum.

global $user_info;
if ($user_info['groups'] == 3){
echo 'your code goes here';
}

Doing this type of thing will not print any of your article to the page.

Xeriar

Speaking of...  is there -any- security at all for the 'add php' option?  Can we even restrict it if we don't want to let members with article access use it?

This website is proudly hosted on Crocweb Cloud Website Hosting.