[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.
fred_41
Registered User
Posts: 40
Joined: Thu Dec 28, 2006 11:11 pm
Location: France : Menars - Loir et Cher
Contact:

Re: [Beta] Topic renew

Post by fred_41 »

Hello to all,

I tried this very good mod, but i have a little problem of this type (see the screenshot)

Image

It seems to me that it is because of the fact that the mod creates an url of the type [http://www.photos-entre-amis//viewtopic.php?t=xxxxx] There is a slash of excess after photos-entre-amis it seems to me!

Thank's in advance
La Passion du Reflex Numérique : │Photos-entre-AmisAnnuaireMon Flickr
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

fred_41 wrote: Hello to all,

I tried this very good mod, but i have a little problem of this type (see the screenshot)


in posting.php find

Code: Select all

SET post_text = '" . $row['post_text'] . $topic_renew_message . "'
and change it to

Code: Select all

SET post_text = '" . addslashes($row['post_text']) . $topic_renew_message . "'
Let me know if that fixed it. The problem is not the double //, that may be a separate problem, the problem is with all your apostrophe's :D
Need custom work done? Pimp My Forum!
fred_41
Registered User
Posts: 40
Joined: Thu Dec 28, 2006 11:11 pm
Location: France : Menars - Loir et Cher
Contact:

Re: [Beta] Topic renew

Post by fred_41 »

OK, Thank you very much, I try and I hold you informed about the resultat :D
La Passion du Reflex Numérique : │Photos-entre-AmisAnnuaireMon Flickr
whatever555
Registered User
Posts: 30
Joined: Tue Apr 03, 2007 3:35 am

Re: [Beta] Topic renew

Post by whatever555 »

Merlin Sythove wrote:
whatever555 wrote: So the action would be, once the topic gets to x amount of pages the next post will regenerate 2 new posts. One will be a copy of the first post in the last topic and the following will be the post that activates the regeneration. Is that possible?


Anything is possible, but like I explained before, that is quite a bit more complicated than simply adjusting the post that is being posted right now. I'll have a think, no promises, and time-wise it will probably next week. If in the meantime you can find the insert post mod and see how recent that is, that would help.


I understand. I will look for that mod in the meantime. I also wanted to let you know that I got the time part working. You were right, it was the GMT, I was even off in my profile. Not sure what I was thinking. Anyway, thanks for all your help and I will look for that insert mod!
fred_41
Registered User
Posts: 40
Joined: Thu Dec 28, 2006 11:11 pm
Location: France : Menars - Loir et Cher
Contact:

Re: [Beta] Topic renew

Post by fred_41 »

Merlin Sythove wrote: Let me know if that fixed it. The problem is not the double //, that may be a separate problem, the problem is with all your apostrophe's :D


That works fine, thank you very much :D
La Passion du Reflex Numérique : │Photos-entre-AmisAnnuaireMon Flickr
whatever555
Registered User
Posts: 30
Joined: Tue Apr 03, 2007 3:35 am

Re: [Beta] Topic renew

Post by whatever555 »

I looked and looked but couldn't find an insert post mod/hack anywhere. Here is what I did find. Not sure if these would be helpful at all. They are not what you were looking for but maybe parts would work for this.

http://www.phpbb.com/community/viewtopic.php?t=300774clone posts mod
This mod will clone a post into a new topic that can be placed into any forum. If you read down there is a user that is thinking along the same lines as me. he added some extra code for keeping the original poster in the first post. I don't know if part of that mod would be helpful in making the first post of the new topic and having the renewd post under it?

I also saw these...

http://www.phpbb.com/community/viewtopic.php?t=128768topics split and move
http://www.phpbb.com/community/viewtopic.php?t=287988 split posts and merge
http://www.phpbb.com/community/viewtopic.php?t=39995It is a php script I wrote to post a new topic and add posts to it, it is not too pretty but it works, feel free to edit so it will be more flexible

I know none of this is what you were looking for but I thought I'd post the links anyway, Maybe they'd be helpful is some way? I'll keep looking for the insert post... :D
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

Thanks, I'll have a look when I have time!
Need custom work done? Pimp My Forum!
floreksa
Registered User
Posts: 16
Joined: Fri Jul 06, 2007 12:49 pm

Re: [Beta] Topic renew

Post by floreksa »

Is there a way to have the new topic that is created show the quoted 1st as a quote or separated in some way from the post that caused the topic to lock and recreate? Right now it looks like the entire post is the 1st poster's post.

So that you'd have:

This topic is the continuation of XXX
Old topic 1st post
New posters text
User avatar
beggers
Registered User
Posts: 1257
Joined: Fri Nov 23, 2001 8:19 pm
Location: Las Vegas
Contact:

Re: [Beta] Topic renew

Post by beggers »

Very cool idea! I've been doing this manually. :)
whatever555
Registered User
Posts: 30
Joined: Tue Apr 03, 2007 3:35 am

Re: [Beta] Topic renew

Post by whatever555 »

yeah, that would help!
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

floreksa wrote:Is there a way to have the new topic that is created show the quoted 1st as a quote or separated in some way from the post that caused the topic to lock and recreate? Right now it looks like the entire post is the 1st poster's post.

So that you'd have:

This topic is the continuation of XXX
Old topic 1st post
New posters text
That is actually already part of the mod. First, this is the section to look for:

Code: Select all

			//Copy the current first post??
			$old_message = '';
			//Testing for now, assume this variable exists and is set, to copy the first post:
			$board_config['topic_renew_first_post'] = false;
			if ($board_config['topic_renew_first_post'])
			{
				$sql = "SELECT * FROM " . POSTS_TEXT_TABLE . " WHERE post_id = " . $topic_info['topic_first_post_id'];
		 		if (!(($result = $db->sql_query($sql)) && ($old_row = $db->sql_fetchrow($result)) ))
				{
					message_die(GENERAL_ERROR, 'Could not obtain first post data to copy', '', __LINE__, __FILE__, $sql);
				}
				//Remove bbcode, that is all you need preg_replace("/\:$bbcode_uid/si", '', $message
				$old_bbcode_uid = $old_row['bbcode_uid'];
				$old_message = addslashes($old_row['post_text']);
				$old_message = preg_replace("/\:$old_bbcode_uid/si", '', $old_message) . "\n\n";
			}
And this partial line

Code: Select all

$board_config['topic_renew_first_post'] = 
sets whether the first post of the current topic, that is about to be closed, will be copied (true) or not (false).

The line

Code: Select all

$old_message = preg_replace("/\:$old_bbcode_uid/si", '', $old_message) . "\n\n";
allows you to further format the old message - it already adds two hard returns.
For example after it add:

Code: Select all

$old_message = "[quote]$old_message[/quote]";
The only problem is that the first message in the current topic about to be closed, MAY contain the first message of a previous topic, plus a reply by someone. You could solve it by having a special divider between the old message and the post, and searching for it to split old message and post.

New addition
Lets add this option to divide the original post from the reply using a unique string so we can copy the original post but not the reply, which are both in the first post of a topic.
First, decide on a string that will divide the old original first post, and the new reply. It must be a string that is very unlikely to ever be used for anything else. For example
*----*----*----*----*----*----*----*----*----*----*
Find

Code: Select all

$old_message = addslashes($old_row['post_text']);
After it add:

Code: Select all

				$divider = "\n*----*----*----*----*----*----*----*----*----*----*"; //New line plus divider
				$divider_pos = strpos($old_message, $divider); //Find divider in old message
				if ($divider_pos) $old_message = substr($old_message, 0, $divider_pos); //Get only old first message
				$old_message .= $divider; //Add a new divider
See if that works for you. To test it you would have to create a topic with a first message that has the divider in it, to see if everything works as planned. If it works, let me know and I'll update the MOD download.
Need custom work done? Pimp My Forum!
floreksa
Registered User
Posts: 16
Joined: Fri Jul 06, 2007 12:49 pm

Re: [Beta] Topic renew

Post by floreksa »

Thanks! I'm testing the code now.

I'm having an issue where the last post isn't including the link to the newly created topic. Where would that be in the code (I'm pretty new to all of this).
Merlin Sythove
Registered User
Posts: 2339
Joined: Tue Mar 16, 2004 7:42 am

Re: [Beta] Topic renew

Post by Merlin Sythove »

Find

Code: Select all

message_die(GENERAL_ERROR, 'Could not update last post in locked topic'
The code before that, is where the link is inserted in the last post in the old closed topic.
Need custom work done? Pimp My Forum!
Post Reply

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