1 (edited by exito100 2005-10-24 10:44)

Topic: feature:forum title and description visible but no access for guests

how about a feature that allows

only registered users can read topics and posts (exists..but) but geusts can still see the forum title and description.

this could motivate more new visitors to register! (i need to reach a significant number of users soon at www.neotango.info - to lower the threshold for registering..)

the current permissions settings make the forum disappear completely for guests when they are not allowed to read.

please let me know if this exists already - smile

regards,

klaus

2 (edited by wenzlerpaul 2005-10-29 16:00)

Re: feature:forum title and description visible but no access for guests

Hi,

I saw a post here and made some modifications on it,

http://punbb.org/forums/viewtopic.php?id=8628

I also wanted the same option you wanted so I tweaked this a little, do the index.php portion, but instead of the viewforum.php, try this code below on the viewtopic.php

first step is backup, backup, and backup.


About line 42 of index.php, replace the following codes

$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

into

$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

That is it for the index.php, now to the viewtopic.php

About line 48 of viewtopic.php, replace the following codes

    if (!$db->num_rows($result))
        message($lang_common['Bad request']);

into

if (!$db->num_rows($result))
{
    $result = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$pid);
    if (!$db->num_rows($result))
        message($lang_common['Bad request']);
    else
        message($lang_common['No view']);        
}

Set all of your posts to members only view inside admin and then the change the language content accordingly..., I have tried this on version 1.2.7 and I do not know about it being applicable to newer versions, I havent checked.

I hope this one helps

Paul

Re: feature:forum title and description visible but no access for guests

thanks a lot wink for this relatively simpe solution - i will try it but right now i am too busy so can t tell when. mabe somebody else wants to post if this works for newer versions too and what happens with later upgrades?