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: 196,004
  • Total Topics: 21,330
  • Online today: 141
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 93
  • Total: 93

Articles

Started by pvcblue, November 29, 2006, 12:45:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pvcblue

Is there a way to make it so ONLY members can read articles, maybe even just members of a certain level?  :o


Thurnok

In the mean time, you can right now but it is a bit more difficult than simply entering the data for a new article.

First, you need to make a PHP article.

Next, in the article body you would surround the information that members are allowed to view like so:

// set up global variables
global $context;

// if user is a member (they are logged in) then show them article
// alternative: (!$context['user']['is_guest'])
if ($context['user']['is_logged']){
// use echo statements to display information here
// example
echo 'This is my article text.  Please read it thouroughly or you will be smited!<br />';
echo 'This is more information, don't forget to read it!';
} else {
echo ' <p /><center>Sorry, you do not have access to this information.</center><br />';
}


If you wanted to limit the viewing to certain membergroups, you could do something like this:

// set up global variables
global $context, $user_info;

// if user is a member of membergroup 7, or 9, then show them article
$valid_groups = array(7,9);
if (array_intersect($valid_groups, $user_info['groups'])){
// use echo statements to display information here
// example
echo 'This is my article text.  Please read it thouroughly or you will be smited!<br />';
echo 'This is more information, don't forget to read it!';
} else {
echo ' <p /><center>Sorry, you do not have access to this information.</center><br />';
}

Thurnok
The one, the only!

pvcblue

oh, not until version 1.0,  :'(

rebelrose

That is very nice information Thurnok.

This website is proudly hosted on Crocweb Cloud Website Hosting.