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: 173
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 105
  • Total: 105

Show / Hide using member ID

Started by s3v3n, January 12, 2009, 07:03:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

s3v3n

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';
}

ed_m2

?

why not set up a special user group for the purpose and set page/category permissions for the article by user group ?

JPDeni

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';
}

This website is proudly hosted on Crocweb Cloud Website Hosting.