Trying to set access to a topic on phpbb

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CCCMTech
Forum Newbie
Posts: 4
Joined: Wed Feb 04, 2004 12:39 pm

Trying to set access to a topic on phpbb

Post by CCCMTech »

Hey guys, can someone help me out on this? I have added a field to the forums_table called auth_see. Then have added this to the permissions list and it does update correctly. Anyways, I am trying to integrate this into the viewtopic.php file. The auth check looks like this:

Code: Select all

<?php
//
// Start auth check
//
$is_auth = array();
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data);

if( !$is_auth['auth_view'] || !$is_auth['auth_read'])
{
	if ( !$userdata['session_logged_in'] )
	{
		$redirect = ( isset($post_id) ) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id";
		$redirect .= ( isset($start) ) ? "&start=$start" : '';
		redirect(append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true));
	}

	$message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);

	message_die(GENERAL_MESSAGE, $message);
}
//
// End auth check
//

?>
So when I try to replace auth_read with auth_see it won't let me in. I always get the $message when logged in, saying ONLY anonymous users can read this topic, which is almost what I want, I want it to be the other way around. I want it to give the error to users whose auth level is below what the Admin sets. So:
anonymous=0
registered=1
etc.

How can I integrate auth_see to redirect them without messing up the rest? I have tried taking out the ! in !$isauth, but that didn't help.

Any ideas?
Post Reply