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,913
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 578
  • Total: 579
  • @rjen

Article Category Permissions

Started by Inny, April 29, 2009, 11:47:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

G6Cad

If Bloc say it might be a bug and it's not in the bugtracker nor fixed, please post a bug report in the bugtracker and add in all the info you can, and also link to this topic .
Bloc might need a reminder of this  :)

andre

Quote from: G6 on June 20, 2009, 09:34:27 AM
If Bloc say it might be a bug and it's not in the bugtracker nor fixed, please post a bug report in the bugtracker and add in all the info you can, and also link to this topic .
Bloc might need a reminder of this  :)
http://www.tinyportal.net/index.php?action=bugtracker;sa=bug524

maldave

Damn this is a nice thread. I have the same problem as Inny has, that is no matter what "access" I give in the article category, member from all groups can still read the artice that I have made.

For example this I have made this article within a article catergory called DKP;

http://www.skyline-mmo.eu/index.php?page=3

If you check the DKP category I have chosen that only moderators and LS member should be able to read the artice yet even someone who is not logged in "aka guest" can read it.

I was thinking maybe there is a way around this until a bugfix is out. For the website that I use I have put a button called "DKP" that is hidden and will only show for certain membergroup. The code to do this in the index.template.php of my current theme is;

if (in_array(7, $GLOBALS['user_info']['groups']))
echo '<li><a' , $current_action=='epguide' ? ' class="current"' : '' , ' href="', $scripturl, '?page=3"><span>DKP</span></a></li>';


What this code does is that only the membergroup 7 is allowed to view this button.

So I was wondering if its possible to have something similar in a php artice, that way you restrict who can see the artice.

My second problem would be what I want inside the artice and my problem here is that its html;

<iframe id="myframe" src="eqdkp" marginheight="0" vspace="0" hspace="0" scrolling="no" width="100%" frameborder="0" height="1200">none</iframe>

So my final question here would be how to make a php artice to work with those 2 codes ?

PS: I use SMF 1.1.9 and TinyPortal v1.0 beta 4


Zetan

When I view the page you posted as a Guest, maldave, I have this returned:

Quote from: http://www.skyline-mmo.eu/index.php?page=3

No news entries found.


Until a bugfix is made, we used to use something like:

Code (PHP) Select


global $context;
if ($context['user']['is_guest'])
{
echo '

This page is available to Members Only. ';
}

else
{
echo '

Members content Here';
}


maldave

#14
Quote from: Zetan on June 24, 2009, 08:33:56 AM
When I view the page you posted as a Guest, maldave, I have this returned:

Quote from: http://www.skyline-mmo.eu/index.php?page=3

No news entries found.


Until a bugfix is made, we used to use something like:

Code (PHP) Select


global $context;
if ($context['user']['is_guest'])
{
echo '

This page is available to Members Only. ';
}

else
{
echo '

Members content Here';
}



The response that you got shouldnt be there so yes, it's a bug. Im going to post this on the Bug section as well so that Bloc can have a look at it ;D

EDIT: I saw someone else already post a bug report about this ^^

maldave

But did you have an answer to my question if its possible to add html code to a php article ?

Zetan

Did you try it?


Code (PHP) Select


{
echo '
<iframe id="myframe" src="eqdkp" marginheight="0" vspace="0" hspace="0" scrolling="no" width="100%" frameborder="0" height="1200">none</iframe>';
}


maldave

#17
Quote from: Zetan on June 24, 2009, 09:38:55 AM
Did you try it?


Code (PHP) Select


{
echo '
<iframe id="myframe" src="eqdkp" marginheight="0" vspace="0" hspace="0" scrolling="no" width="100%" frameborder="0" height="1200">none</iframe>';
}



Ok I tried and it it worked wonders ;D You are the king Zetan. Here is the php code with the iframe code;

{
global $context;
if ($context['user']['is_guest'])
echo '
This page is available to Members Only. ';
}
{
global $context;
if (in_array(7, $GLOBALS['user_info']['groups']))
echo '
<iframe id="myframe" src="eqdkp" marginheight="0" vspace="0" hspace="0" scrolling="no" width="100%" frameborder="0" height="1200">none</iframe>';
}


As you can see this will only show for group 7, and if you are a guest that tries to look at the article you will only get "This page is available to Members Only".
My followup question here is if you want group 7 and group 9 to be able to access the artice. I did the following change to code and it worked, basically added another global $context;

{
global $context;
if ($context['user']['is_guest'])
echo '
This page is available to Members Only. ';
}
{
global $context;
if (in_array(7, $GLOBALS['user_info']['groups']))
echo '
<iframe id="myframe" src="eqdkp" marginheight="0" vspace="0" hspace="0" scrolling="no" width="100%" frameborder="0" height="1200">none</iframe>';
}
{
global $context;
if (in_array(9, $GLOBALS['user_info']['groups']))
echo '
<iframe id="myframe" src="eqdkp" marginheight="0" vspace="0" hspace="0" scrolling="no" width="100%" frameborder="0" height="1200">none</iframe>';
}


Even though this works I'm feeling the the code is to long and that you can somehow make it a lot shorter then I have done it. ^^

Zetan

I've been called many things... &@Ã,£^ etc..


have you tried



if (in_array(7,9,10,11, $GLOBALS['user_info']['groups']))


maldave

Quote from: Zetan on June 24, 2009, 02:04:57 PM
I've been called many things... &@Ã,£^ etc..


have you tried



if (in_array(7,9,10,11, $GLOBALS['user_info']['groups']))



Yes I tried that but then it wont show anything. If I have only 7 or only 9 then it works. If I try to input more then one group i.e. 7,9 then it wont show.

This website is proudly hosted on Crocweb Cloud Website Hosting.