[Beta] Topic renew

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

[Beta] Topic renew

Post by Merlin Sythove »

Code: Select all

##############################################################
## MOD Title: MOD Topic_renew
## MOD Author: Merlin Sythove <Merlin@silvercircle.org> Dennis http://www.silvercircle.org
## MOD Description: This mod will automatically:
##         a. lock a topic if it reaches   x amount of pages (set in the Admin Control Panel).
##         b. append the number 1 to the old topic title if no number present yet.
##         c. open a new topic with the same title and the next number
##         d. post the post there
##         e. create cross-links in the last post of the old topic, and the first post of the new topic
##         f. Update topic watches to switch to the new topic
##         g. If someone was busy posting whilst someone else renews a topic like this,
##               their post will be appended to the newly made topic automatically
##
## MOD Version: 0.9.0
##
## Installation Level: (Easy)
## Installation Time: 10 Minutes by hand
## Files To Edit:
##         posting.php
##      language/lang_english/lang_main.php
## If you want to install the ACP section:
##      language/lang_english/lang_admin.php
##      admin/admin_board.php
##      templates/subSilver/admin/board_config_body.tpl
##
## Included Files: (N/A)
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
MOD Download: http://www.pimpmyforum.nl/downloads/mod ... _renew.txt

This mod was a request from some people, as well as something I wanted myself. Topic regeneration, topic rebirth, topic renewal, automatic topic splitting, are all words to describe it.

The mod will automatically close a topic, and open a new successor to the topic, when a topic reaches X pages. This is to prevent topics becoming too long and unwieldy. You can set the amount of pages to anything you like, the default is 100 pages. You can adjust the default in code and completely skip the Admin Control Panel section if you want.

The actual mod functionality consists of little more than 2 chunks of code in posting.php.

The first chunk of code will see if your post will make renewing the topic necessary. If so, it will close the current topic, do some admin, and allow you to post your post as if you were making a new topic with the correct title, and a backlink to the closed topic. It will also change your post to be appended to the new topic, if you were just going to post to the old topic that is closed by now.

The second chunk of code will do more admin (topic watches) and add a forward link to the last post in the closed topic.

The forward and backward link messages are in the language file and customiseable.

Have fun!
Last edited by Merlin Sythove on Mon Apr 09, 2007 11:37 am, edited 2 times in total.
Need custom work done? Pimp My Forum!
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

Code download: see above.
Last edited by Merlin Sythove on Mon Apr 09, 2007 6:39 am, edited 2 times in total.
Need custom work done? Pimp My Forum!
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

How to test drive this mod, after installation: See here.
Last edited by Merlin Sythove on Wed Apr 11, 2007 6:49 am, edited 1 time in total.
Need custom work done? Pimp My Forum!
whatever555
Registered User
Posts: 30
Joined: Tue Apr 03, 2007 3:35 am

Re: [Beta] Topic renew

Post by whatever555 »

Let me just say that this mod is great!!! Thank you!!!

I do have a couple of questions.

#1 Is there a way to have the first post of the thread always be the first post when the thread regenerates? Most of the groups on my site have a front page. It's the first post of the thread. Only the person who started the thread can edit it but that ok. Unless there is a way to let anyone in the group edit only the first post?

#2 Is there a way to set a time along with the number of pages that it takes for the thread to regenerate? For instance, I'd like them to regenerate at midnight so no one gets lost if the thread regenerates while they are posting. If my midnight the thread has x amount of pages then it will regenerate at 12:01am. Make sense?

#3 Is there a way to only have regenerating threads in one catagory or forum? Maybe the setting can be in the ACP? Forum permissions? Or something like that?

Either way, great Mod!!! Thanks!
User avatar
3Di
Former Team Member
Posts: 16053
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 - Frankfurt 🇩🇪
Name: Marco
Contact:

Re: [Beta] Topic renew

Post by 3Di »

Hello,

Please edit your topic starter as outlined in MOD Development forum rules section 3.f.5. This will allow people to see what your MOD is about at a glance.

We see that you've posted your MOD's contents in your topic starter. Please instead offer your MOD as a textfile download (uploading your MOD's install textfile to a server and giving a direct link, with no registration restrictions), rather than posting the MOD's contents in your post, as you have done.

Thank you for your cooperation,
The phpBB MOD Team
To request support for our extensions you can also contact me here: phpBB Studio

Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
🚀 Looking for a specific feature or alternative option? We will rock you! 🚀
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

First post updated etc., thanks.
Need custom work done? Pimp My Forum!
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

whatever555 wrote: Let me just say that this mod is great!!! Thank you!!!

I do have a couple of questions.

#1 Is there a way to have the first post of the thread always be the first post when the thread regenerates? Most of the groups on my site have a front page. It's the first post of the thread. Only the person who started the thread can edit it but that ok. Unless there is a way to let anyone in the group edit only the first post?


I'll have a look into that.
#2 Is there a way to set a time along with the number of pages that it takes for the thread to regenerate? For instance, I'd like them to regenerate at midnight so no one gets lost if the thread regenerates while they are posting. If my midnight the thread has x amount of pages then it will regenerate at 12:01am. Make sense?


I don't think that is necessary. Because the mod already solves this problem. If someone starts replying when a topic is still open, and posts when that topic has been closed and renewed, then their post will automatically be appended to the NEW topic. They may have some "huh?" experience to see their post on page 1 of a new topic, but (assuming people know about the mod, and the type of topic they are replying to) they should realise what is happening. No post is lost, in any case!
#3 Is there a way to only have regenerating threads in one catagory or forum? Maybe the setting can be in the ACP? Forum permissions? Or something like that?


The simplest way is to hard code this. The essence of this mod is to prevent unwieldy topics of many hundreds of pages, and that applies anywhere, not just on some forums. However, I could see the use for having 10-page topics in one forum, and a maximum of 100-page topics elsewhere.

This is how you would make such custom requirements:

Find in posting.php, after installing the mod, i.e. in the code you just added:

Code: Select all

$topic_max_replies = $topic_max_pages * $board_config['posts_per_page'];
After, add

Code: Select all

//Customise some forums to have say a maximum of 10 pages per topic, irrespective of the ACP setting:
if ($forum_id == 2 || $forum_id == 3) //For forum 2 and forum 3
{
  //Use a fixed amount of pages
  $topic_max_replies = 10 * $board_config['posts_per_page'];
  //Use a quarter of the pages for normal topics elsewhere:
  //$topic_max_replies = floor($topic_max_pages/4) * $board_config['posts_per_page'];
}
Need custom work done? Pimp My Forum!
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

As part of the request, I have made a separate mod that allows the poster to give anyone the power to edit that particular individual post.

[BETA] Post edit all * Anyone can edit a given post

This would allow anyone to edit the very first post in a topic, for example, if the author or mod or admin, cares to check the "Allow anyone to edit this post" check box.
Need custom work done? Pimp My Forum!
whatever555
Registered User
Posts: 30
Joined: Tue Apr 03, 2007 3:35 am

Re: [Beta] Topic renew

Post by whatever555 »

Once again, you rock! Thank you!

If you would be willing to work on the first request I would be forever greatful! That is probably the one I would use the most. :D

As for the time part, the reason it would be nice is to end any confusion along with knowing that all threads over a certian amount of pages would all regenerate at the same time. But definately not something that I have to have.

What you worked out for my thrid request is perfect!!! Thanks for all your hard work!
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

whatever555 wrote: As for the time part, the reason it would be nice is to end any confusion along with knowing that all threads over a certian amount of pages would all regenerate at the same time. But definately not something that I have to have.


Well, that is the point, they wouldn't. Topics don't regenerate without someone posting, and you don't control when people post.

It is probably possible, not very easy.
Need custom work done? Pimp My Forum!
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

whatever555 wrote: #1 Is there a way to have the first post of the thread always be the first post when the thread regenerates? Most of the groups on my site have a front page. It's the first post of the thread. Only the person who started the thread can edit it but that ok. Unless there is a way to let anyone in the group edit only the first post?


That last bit is a separate mod I wrote today and I have already posted a link.

As for copying the first message of the existing thread and starting the new thread with that: well, it is computers, anything is possible. But it is not just a few lines, you're talking a major piece of code here.
There is a mod called InsertPost, that might be used, after editing it so that the new feature that anyone can edit the fist post, is incorporated.
Still some work but less difficult, is to find the first topic in the chain (assuming topic titles with trailing numbers are unique) and the first post in it, and adding a link to the first post of the new topic.

I'll keep on thinking for now.
Need custom work done? Pimp My Forum!
whatever555
Registered User
Posts: 30
Joined: Tue Apr 03, 2007 3:35 am

Re: [Beta] Topic renew

Post by whatever555 »

I guess I wasn't thinking about how it was working. You are right about the time part. I know it can be done because there are a couple sites that I know of that have it that way.

Let me see what I can work on for the insert post part. That sounds more like what I would need. The people on my site get clicky and like to set the first page of their topic up with images and things. When they start a new topic, they add all the info from the previous first post to the first post in the new topic. Making it their own I. So let me see what I can come up with using the insert post mod. If you can think of anything else please let me know. Thanks for all your help.

Do you know if there is a way to add a date of closing/opening along with the link to the new post? Or am I getting away from myself again?
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

whatever555 wrote: I guess I wasn't thinking about how it was working. You are right about the time part. I know it can be done because there are a couple sites that I know of that have it that way.


How do they do it then? Do they split topics that have become too long at midnight at the X page mark, by running a special robot that does this?
Let me see what I can work on for the insert post part. That sounds more like what I would need. The people on my site get clicky and like to set the first page of their topic up with images and things. When they start a new topic, they add all the info from the previous first post to the first post in the new topic. Making it their own I. So let me see what I can come up with using the insert post mod. If you can think of anything else please let me know. Thanks for all your help.


Actually, if you want to include the first post (of the topic that is just being closed, not the first of the whole chain) into the post of the person who is just posting, then that would be fairly easy. It could be a quote, or it could be marked with a line or something. So you would get:

Code: Select all

Message: this topic is a continuation of (link to old topic last post)

Copy of post 1 in old topic

===========================

Message that person was going to post in the old topic
Since the post is the person's own, they can edit it as they like.
But going back along the chain to the very first topic that started the chain is difficult, it depends on topic titles being unique and that is not a safe assumption.
Do you know if there is a way to add a date of closing/opening along with the link to the new post? Or am I getting away from myself again?


The date when the topic that is just being closed, was started, is known, and could be inserted somewhere.
The date of closing the old topic is the same as the date of opening this one :-)
Need custom work done? Pimp My Forum!
whatever555
Registered User
Posts: 30
Joined: Tue Apr 03, 2007 3:35 am

Re: [Beta] Topic renew

Post by whatever555 »

Merlin Sythove wrote: How do they do it then? Do they split topics that have become too long at midnight at the X page mark, by running a special robot that does this?


Yes, it's something like that. I'm not sure how it is done though. I know at midnight, or around there, if a post has x amount of posts then it is closed and a new topic is opened using the first post in the last topic.

There is a closing mod out there, I believe it is called, close topic after x amout of posts, that will close a topic after x amount of posts and at a certian time. Let me see if I can find the link later today. Maybe you could look at how that is done and incorporate that here?
Merlin Sythove wrote: Actually, if you want to include the first post (of the topic that is just being closed, not the first of the whole chain) into the post of the person who is just posting, then that would be fairly easy. It could be a quote, or it could be marked with a line or something. So you would get:


Code: Select All
Message: this topic is a continuation of (link to old topic last post)

Copy of post 1 in old topic

===========================

Message that person was going to post in the old topic


That is exactly what I want to do except could it be the actual first post of the last topic in the chain that is displayed rather then just a link?


The date when the topic that is just being closed, was started, is known, and could be inserted somewhere.
The date of closing the old topic is the same as the date of opening this one
whatever555 wrote: I guess I wasn't thinking about how it was working. You are right about the time part. I know it can be done because there are a couple sites that I know of that have it that way.


How do they do it then? Do they split topics that have become too long at midnight at the X page mark, by running a special robot that does this?
Let me see what I can work on for the insert post part. That sounds more like what I would need. The people on my site get clicky and like to set the first page of their topic up with images and things. When they start a new topic, they add all the info from the previous first post to the first post in the new topic. Making it their own I. So let me see what I can come up with using the insert post mod. If you can think of anything else please let me know. Thanks for all your help.


Actually, if you want to include the first post (of the topic that is just being closed, not the first of the whole chain) into the post of the person who is just posting, then that would be fairly easy. It could be a quote, or it could be marked with a line or something. So you would get:

Code: Select all

Message: this topic is a continuation of (link to old topic last post)

Copy of post 1 in old topic

===========================

Message that person was going to post in the old topic
Since the post is the person's own, they can edit it as they like.
But going back along the chain to the very first topic that started the chain is difficult, it depends on topic titles being unique and that is not a safe assumption.
Do you know if there is a way to add a date of closing/opening along with the link to the new post? Or am I getting away from myself again?

Merlin Sythove wrote: The date when the topic that is just being closed, was started, is known, and could be inserted somewhere.
The date of closing the old topic is the same as the date of opening this one :-)


oops, my bad. :D So you could add that date to the first and last post? NOt something I'd have to have but it would be nice to have a timeline.

Oh, one more thought. Do you know where I can find that insert post mod? I looked for it but couldn't find it but I know I've seen it. :?

Thanks again!!! You rock!
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

whatever555 wrote:
Merlin Sythove wrote: How do they do it then? Do they split topics that have become too long at midnight at the X page mark, by running a special robot that does this?


Yes, it's something like that. I'm not sure how it is done though. I know at midnight, or around there, if a post has x amount of posts then it is closed and a new topic is opened using the first post in the last topic.


OK, that is possible. I'm not going to go there though, for processes to work independently on a timer, you need CRON. I work strictly only as a result of a person doing something. So if someone doesn't post around midnight, nothing will happen at that time to that topic :-)

Anyway, I have a next installment, I'll post it in the next post.
Need custom work done? Pimp My Forum!
Post Reply

Return to “[2.0.x] MODs in Development”