TinyPortal

Development => Support => Topic started by: s3v3n on January 12, 2009, 07:03:58 AM

Title: Show / Hide using member ID
Post by: s3v3n on January 12, 2009, 07:03:58 AM
Hi, I am using tiny portal 1.0.6 & SMF 1.1.7, what I am trying to do is make custom pages viewable only by certain members ids.

This is the code I have so far, but it doesn't seem to work.

$perms = $GLOBALS['user_info']['memberid'];

if (in_array('10',$perms)){
echo 'This section is still under construction!!';
}else{

echo 'You do not have the correct credentials to view this section.';
}


I was also trying it this way..

if ($ID_MEMBER['memberID']['1']){
echo 'test';
}else{
echo 'fail';
}
Title: Re: Show / Hide using member ID
Post by: ed_m2 on January 12, 2009, 08:58:34 AM
?

why not set up a special user group for the purpose and set page/category permissions for the article by user group ?
Title: Re: Show / Hide using member ID
Post by: JPDeni on January 12, 2009, 03:26:19 PM
Try this:


global $ID_MEMBER;

if ($ID_MEMBER == 1) {
  echo 'yes';
} else {
  echo 'no';
}


This will print out the word 'yes' if the ID of the person looking at the block is equal to 1. That's usually you, if you were the person who installed TP.

If you want to have a list of people's IDs, you can do something like this:


global $ID_MEMBER;

$perms = array(1,7,9,137); // ID numbers of people who you like

if (in_array($ID_MEMBER,$perms) {
  echo 'yes';
} else {
  echo 'no';
}