TinyPortal

Development => Support => Topic started by: kimba on July 26, 2007, 05:03:47 AM

Title: Permissions for guests
Post by: kimba on July 26, 2007, 05:03:47 AM
I have a slight problem here. I've just added TP to my SMF forum and I want guests to view the articles in TP but not the actual forum. The permissions don't seem to allow "view TinyPortal" for guests. Is there any way around it?
Title: Re: Permissions for guests
Post by: IchBin on July 27, 2007, 12:57:19 AM
TinyPortal doesn't have any of these permissions built into the article system yet.
Title: Re: Permissions for guests
Post by: Elrond on November 07, 2007, 02:53:56 AM
I would recommend you take use of the PHP articles system. You basically don't even NEED to worry about permissions if you make certain articles and categories php articles.

Just about every function in TP as well as SMF uses the context global variable, correct? Well, if you make the article a php article you could easily set the permissions through the php code you enter.

For example, I disabled guests on some of my articles by doing the following:

if(!$context['user']['is_guest'])
{
//my article's in here.
}

If you wanted only admins (those with group id = 1) to see it, that'd be just as simple, just change the variable:

if(!$context['user']['is_admin'])
* repeat same as above *

You could use the user_info global variable as well as it is available in the TPortal.php file in the sources folder as well as in the TPortal.template.php in your themes' folders.

And wolla, there's yer permissions.

(Extension of the above: you may use the $story['id'] variable along with scripturl global variable to put together url links that you may use in conjunction with your own variable to go to the same article, except with different variables, to control the conditions of the sub-article's content. You can basically do anything you want with PHP articles. It's simply fantastic!!!)

Along with having trusted staff using your articles management system (the first recommendation for any such system), being able to take use of the variables already available in SMF and TinyPortal is also useful. TinyPortal works great for everything. Just fantastic, truly fantastic! I just started using TP 3 days ago too, and already love it!