1 (edited by MattF 2007-05-19 15:15)

Topic: Single post topic forum

Firstly, apologies if I've put this in the wrong forum. Couldn't quite decide where it should go. big_smile

What areas would one need to concentrate on to create a forum where it is possible for any user to create a topic/thread, but once created, that topic/thread can only be edited by the user who created it, and they are only able to edit the original post, not add further posts to the topic/thread? It will in essence be a single post topic that can only be updated/edited by it's creator.

Simple idea for this one is something akin to an incorporated write-up/wiki section using the forums abilities, rather than utilising an external programme. Have been looking at wiki's and such over the last several weeks, and they all have problems or lack required elements, or are simply devilishly hard to use. The forum itself is a familiar interface for the users, however, and has all the pre-requisites, so I've decided to go down the route of modifying the forum itself rather than trying to tie in an external programme to achieve the required purpose.


Cheers,

Matt

2

Re: Single post topic forum

Hi Matt,

DokuWiki is very easy to install and is in the same spirit of Pun, very light.

It also has backend authenticattion for Wiki users against the Forum database:
http://wiki.splitbrain.org/wiki:auth:punbb?s=punbb

I use Doku cause there are times when it's better to use a hammer than the handle of a screwdriver.

Re: Single post topic forum

Unless I'm wrong, that's easily possible
Create a forum, edit its permissions in admin_forums.php. Make sure that people can only post topics, not replies. Then make sure people can edit their own posts. Tada! tongue

4 (edited by MattF 2007-05-19 16:31)

Re: Single post topic forum

hcgtv wrote:

Hi Matt,

DokuWiki is very easy to install and is in the same spirit of Pun, very light.

It also has backend authenticattion for Wiki users against the Forum database:
http://wiki.splitbrain.org/wiki:auth:punbb?s=punbb

I use Doku cause there are times when it's better to use a hammer than the handle of a screwdriver.

That was the one which looked most promising, but had various problems. Firstly, the PunBB authentication is for mysql only, and secondly, I couldn't get to grips with it's use within the first hour. I work on the motto that if I cannot figure it out within the hour, the less technical ones have no chance. big_smile Ease of use is the primary concern, and the forum usage is now second nature to them. big_smile

5

Re: Single post topic forum

Smartys wrote:

Unless I'm wrong, that's easily possible
Create a forum, edit its permissions in admin_forums.php. Make sure that people can only post topics, not replies. Then make sure people can edit their own posts. Tada! tongue

Ooh, if that's the case, I'll be well chuffed. I'm gonna' have a diddle now. Thanks ever so much for that pointer. big_smile

6 (edited by MattF 2007-05-19 18:00)

Re: Single post topic forum

Right. Almost there. That works a treat. smile Only two deviations I need are that I want to differ the delete and edit settings from the global ones for forums that are post topic only, so that delete is disabled but edits are allowed indefinitely. So, would I need to adjust viewforum.php and viewtopic.php for this? Would it suffice to, if post_replies = 0, to set the following two within the script as below to allow the above?

g_delete_posts = 0
g_edit_subjects_interval = 0


Thanks again,

Matt

Edit: Just been delving, and it appears that it's viewtopic.php and edit.php tht will need some slight alteration?

7 (edited by MattF 2007-05-19 19:11)

Re: Single post topic forum

Sorted that little quibble. big_smile Like a muppet, I didn't twig that the edit time only refers to the subject, so that one is an irrelevant point. big_smile The delete bit can be sorted by changing, in viewtopic.php around line 320:


$post_actions[] = '<li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>';

To:

if ($cur_topic['post_replies'] == '') {
        $post_actions[] = '<li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>';
}

Deletion will then be disabled for single topic forums. Cheers for the advice and help. smile


Matt

Re: Single post topic forum

Well, it won't be disabled, the link is just hidden. You would need to make a similar edit in delete.php wink

9

Re: Single post topic forum

Smartys wrote:

Well, it won't be disabled, the link is just hidden. You would need to make a similar edit in delete.php wink

big_smile big_smile

Is that $cur_topic['post_replies'] variable/element already available in delete.php, or will it need to be introduced?

Re: Single post topic forum

You need to edit the initial query for $cur_post to grab the post_replies column

11

Re: Single post topic forum

Smartys wrote:

You need to edit the initial query for $cur_post to grab the post_replies column

Just been having a look at the delete.php db query, and it looks as if the post_replies is already in the lookup? This line:

$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_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) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

Is that the right one, the fp.post_replies? If so, would I just use $cur_post['post_replies'] instead of the $cur_topic['post_replies'] var?


Thanks once again. smile

Matt

12

Re: Single post topic forum

Sorted that last bit. big_smile The query is already there, so starting at line 58:

if (($pun_user['g_delete_posts'] == '0' ||
        ($pun_user['g_delete_topics'] == '0' && $is_topic_post) ||
        $cur_post['poster_id'] != $pun_user['id'] ||
        $cur_post['closed'] == '1') &&
        !$is_admmod)
        message($lang_common['No permission']);

That block above needs the following line adding: $cur_post['post_replies'] != '' ||

so that it looks like the following:

if (($pun_user['g_delete_posts'] == '0' ||
        ($pun_user['g_delete_topics'] == '0' && $is_topic_post) ||
        $cur_post['poster_id'] != $pun_user['id'] ||
        $cur_post['post_replies'] != '' ||
        $cur_post['closed'] == '1') &&
        !$is_admmod)
        message($lang_common['No permission']);

Thanks again for the advice. smile

Matt

Re: Single post topic forum

MattF wrote:
Smartys wrote:

You need to edit the initial query for $cur_post to grab the post_replies column

Just been having a look at the delete.php db query, and it looks as if the post_replies is already in the lookup? This line:

$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_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) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

Is that the right one, the fp.post_replies? If so, would I just use $cur_post['post_replies'] instead of the $cur_topic['post_replies'] var?


Thanks once again. smile

Matt

You're right, I could have sworn that it wasn't in the query though tongue

14

Re: Single post topic forum

Smartys wrote:

You're right, I could have sworn that it wasn't in the query though tongue

With the length of that query it's devilishly easy to miss. I needed a judicious dose of grep and reading it several times to find it. big_smile Thanks ever so much for all your help and advice, btw. smile


Matt