Topic: How can I do these things on my forums?

- Mark a post that has been edited since your last view of it as unread (I dunno, maybe, this one might be a bit tricky)
- Delete redirects to topics (Moved: blah blah blah)
- Disable silent edits
- Create a new user group and be able to give it's members moderator priveleges

Looking for a certain modification for your forum? Please take a look here before posting.

Re: How can I do these things on my forums?

4 isn't possible without editing every $is_admmod check and a couple others wink
3 is possible by commenting out the checkbox and changing

$edited_sql = (!isset($_POST['silent']) || !$is_admmod) ? $edited_sql = ', edited='.time().', edited_by=\''.$db->escape($pun_user['username']).'\'' : '';

to

$edited_sql = ', edited='.time().', edited_by=\''.$db->escape($pun_user['username']).'\'';

2. Is possible through moderate.php, they delete like normal topics

1. Is very difficult tongue

Re: How can I do these things on my forums?

Smartys wrote:

4 isn't possible without editing every $is_admmod check and a couple others wink

Sorry, but I really don't know what that means.

Smartys wrote:

3 is possible by commenting out the checkbox and changing

$edited_sql = (!isset($_POST['silent']) || !$is_admmod) ? $edited_sql = ', edited='.time().', edited_by=\''.$db->escape($pun_user['username']).'\'' : '';

to

$edited_sql = ', edited='.time().', edited_by=\''.$db->escape($pun_user['username']).'\'';

Thanks! I'll have to give it a try.

Smartys wrote:

2. Is possible through moderate.php, they delete like normal topics

Oops... I never even thought of that.

Smartys wrote:

1. Is very difficult tongue

Yeah, I kinda thought it would be.

Looking for a certain modification for your forum? Please take a look here before posting.

4 (edited by Jérémie 2005-09-25 00:38)

Re: How can I do these things on my forums?

Smartys wrote:

1. Is very difficult tongue

Nope, it's very simple. And very much needed. But that's an old debate...

For pogenwurst: look at the MarkAsRead modification. But it's a mod, so that mean ssh, svn, diff, patch, grep and all kind of dino-geeky-wizard things to keep your punbb updated after it (when it can be updated).

5

Re: How can I do these things on my forums?

I can't see the difficulty either. Isn't it just a case of checking against both the post time and edit time and if either is newer than the last visit time mark the post as new. Or did you mean posts that have been edited during the current visit.

Re: How can I do these things on my forums?

Now that I think about it, if you keep a "last edited" and "last edited post id" for each topic, you can check both: I was only thinking in terms of modding the code from what already existed.

Oh, and to explain #4 a little better
With a plain PunBB install, it's impossible to add another moderator group. However, if you edit the line in certain files for the variable $is_admmod (ie: edit.php, delete.php, viewforum.php, etc) so that another group matches it, you've "added" a group as moderators. You also have to make edits in profile.php so you can assign people in that user group to forums

Re: How can I do these things on my forums?

Smartys wrote:

Now that I think about it, if you keep a "last edited" and "last edited post id" for each topic, you can check both: I was only thinking in terms of modding the code from what already existed.

Sorry sad, but once again, I really can't say that I understand what you're saying.

Smartys wrote:

Oh, and to explain #4 a little better
With a plain PunBB install, it's impossible to add another moderator group. However, if you edit the line in certain files for the variable $is_admmod (ie: edit.php, delete.php, viewforum.php, etc) so that another group matches it, you've "added" a group as moderators. You also have to make edits in profile.php so you can assign people in that user group to forums

Ok, I see what you're saying now. My PHP isn't that good, and I'm not that familiar with PunBB's source or inner workings or anything, but anyway could I do something along these lines?:

if ($someusergroup) {$is_admmod = TRUE}

If that's possible, is there a file in /include or something (common.php? - I dunno, just guessing by the name) to which I could add the code? Or would I just have to add it individually to each file where it's needed (assuming that would work, of course).

Hopefully multiple moderator user groups will be a feature in an upcoming version.

Jérémie wrote:

For pogenwurst: look at the MarkAsRead modification. But it's a mod, so that mean ssh, svn, diff, patch, grep and all kind of dino-geeky-wizard things to keep your punbb updated after it (when it can be updated).

Do you mean this: http://punres.org/viewtopic.php?id=321 ? Does that mod achieve the desired effect with editing posts that I mentioned before? I haven't seen anything saying it does, but maybe I missed something. Anyway, I don't mind installing mods - actually, I enjoy it, and have done so on several occasions. That mod was actually one I was planning on adding anyway.

Paul wrote:

I can't see the difficulty either. Isn't it just a case of checking against both the post time and edit time and if either is newer than the last visit time mark the post as new. Or did you mean posts that have been edited during the current visit.

Current visit would be preferrable, but just from last visit would be good too, and, in most cases, be good enough. How would I go about doing this?

Looking for a certain modification for your forum? Please take a look here before posting.

Re: How can I do these things on my forums?

"Sorry sad, but once again, I really can't say that I understand what you're saying."
You add 2 columns to the topic table in your database: last edited time, last edited ID. When a post is edited, you set them. When you go to viewforum.php, you have it check not only the last posted time (which it already does) but the last edited time as well

"Does that mod achieve the desired effect with editing posts that I mentioned before?"
No, it simply makes the topic read icons get marked more accurately smile

"Ok, I see what you're saying now. My PHP isn't that good, and I'm not that familiar with PunBB's source or inner workings or anything, but anyway could I do something along these lines?:"
Kind of tongue
But if you did that, they would have moderation powers in all forums (including admin only forums!) tongue

"If that's possible, is there a file in /include or something (common.php? - I dunno, just guessing by the name) to which I could add the code? Or would I just have to add it individually to each file where it's needed (assuming that would work, of course)"
Nope, it has to be manually edited in each file (of course, you could change it so that they all include 1 file, and have that 1 file have the is_admmod stuff).

Re: How can I do these things on my forums?

Hello,

I might have a quickfix for question #1:

1) open 'edit.php' in the root directory:

2) find around line 126:

                // Update the post
                $db->query('UPDATE '.$db->prefix.'posts SET message=\''.$db->escape($message).'\', hide_smilies=\''.$hide_smilies.'\''.$edited_sql.' WHERE id='.$id) or error('Unable to update post', __FILE__, __LINE__, $db->error());

3) Add below:

//----------------- Mark edited message as new--------------
                $errormessagestring='Post id='.$id.', Last poster='.$cur_post['poster'].' Topic id='.$cur_post['tid'];
                $db->query('UPDATE '.$db->prefix.'topics SET last_post='.time().', last_post_id='.$id.', last_poster=\''.$cur_post['poster'].'\' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic. '.$errormessagestring, __FILE__, __LINE__, $db->error());

4) open 'view_forum.php' (again in the root directory)

5) find around line 166:

                if (!$pun_user['is_guest'] && $cur_topic['last_post'] > $pun_user['last_visit'] && $cur_topic['moved_to'] == null)

5) replace by:

                if (!$pun_user['is_guest'] && (($cur_topic['last_post'] > $pun_user['last_visit']) OR ($cur_topic['edited'] > $pun_user['last_visit'])) && $cur_topic['moved_to'] == null)

This should do the trick with no excessive costs smile

Re: How can I do these things on my forums?

erm, wtf is $cur_topic['edited']?
and why use OR? use ||
And that doesn't update the forum last posting info (on the index page)

Re: How can I do these things on my forums?

$cur_topic['edited'] when the topic was last edited?
and OR is perfectly acceptable is it not?

Re: How can I do these things on my forums?

Connorhd wrote:

$cur_topic['edited'] when the topic was last edited?
and OR is perfectly acceptable is it not?

Sorry, I meant why use it? He has it updating last_post anyway
and OR works, but for the sake of consistancy he should use || wink

Re: How can I do these things on my forums?

lol k, your post just read uncharacteristically hostile tongue

14 (edited by Eternaute 2006-01-11 09:45)

Re: How can I do these things on my forums?

Thanks for your support Smartys, glad you appreciated my fix before crying at me, very positive attitude tongue

I thought this mod would be welcomed better, but, anyway, I won't discuss more on that and here is the fix for the fix (fixing, coding, same thing isn't it? smile )

6 ) After modifications around line 126 (step 2) add:

                $errormessagestring='Post id='.$id.', Last poster='.$cur_post['poster'].' Forum id='.$fid;
                $db->query('UPDATE '.$db->prefix.'forums SET last_post='.time().', last_post_id='.$id.', last_poster=\''.$cur_post['poster'].'\' WHERE id='.$cur_post['fid']) or error('Unable to update forums. '.$errormessagestring, __FILE__, __LINE__, $db->error());

The edited message now appears in the main page of the forum as new. Happy foruming!

Re: How can I do these things on my forums?

Eternaute, thanks for posting your fix! I'll be sure to try it out.

Sorry I'm a little late with responding. I kind of forgot about this thread.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: How can I do these things on my forums?

You're welcome PogenWurst big_smile
Do not apologize for being late, moderating a forum is such a big piece of work I couldn't blame you lol!