[MOD-DB] Clone posts

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.
Locked
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

[MOD-DB] Clone posts

Post by asinshesq » Thu May 19, 2005 3:11 am

Here's a mod that allows any admin or mod, as well as any person authorized to post polls, to clone posts as new topics.

You may ask, since copying posts is really easy, why is this useful? Answer: if the post contains a complicated poll then copying it is not so easy. And, if the post contains a complex survey (because the board has installed my tabualted survey at topic head mod that you can find here: http://www.phpbb.com/phpBB/viewtopic.php?t=278888 ), it can be really difficult to copy the post and survey over into a new topic. This mod automates all that and clones the post plus any poll or survey into a new topic.

Anyway, here it is...see what you think:

http://asinshesq.dynalias.com/clone_posts.zip

(The mod only takes a few minutes to install since the guts of the mod is in a new file called clone.php.)

By the way, I want to thank Thatbitextra for being kind enough to make the 'clone' button that I use in this mod.
Last edited by asinshesq on Fri Jul 08, 2005 11:21 pm, edited 3 times in total.

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq » Fri May 20, 2005 1:18 pm

phpbb.com user 'mistakeprone' made a good suggestion about how this could be used :idea:. She suggested that admins set up a private forum that regular users can't see and post in there examples of form posts that the admin can clone from time to time and tweak as the need arises.

User avatar
3Di
Former Team Member
Posts: 14482
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Post by 3Di » Fri May 20, 2005 2:11 pm

asinshesq wrote: phpbb.com user 'mistakeprone' made a good suggestion about how this could be used :idea:. She suggested that admins set up a private forum that regular users can't see and post in there examples of form posts that the admin can clone from time to time and tweak as the need arises.



So do I.
Simply i EDIT (but submit again) the hidden post and I copy/paste it in the right place ;)

Greets, 3D

p.s.: the private forum can also be used as a bin (trashcan), in this way you can save undesidered posts or such. :)
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
✒️ Black Friday 2019 @ The Studio ▪️◾️

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq » Fri May 20, 2005 2:18 pm

3Di wrote: ...Simply i EDIT (but submit again) the hidden post and I copy/paste it in the right place ;)...


Right, but you won't need to do it that way if you use this mod...you can just click 'clone' and a new post will open up with the old text (and any poll or survey that happened to be in the post) in it. You would then edit the text (and any post or survey) in whatever way you wanted and then submit the post and it will appear as a new topic in whatever forum you select.

User avatar
3Di
Former Team Member
Posts: 14482
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Post by 3Di » Fri May 20, 2005 2:22 pm

(and any poll or survey that happened to be in the post)


I got the sense of your MOD now, indeed ;)

Just a question: do you know if is it compatible with CH RC5?

* not enough time to check it myself, but don't worry *
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
✒️ Black Friday 2019 @ The Studio ▪️◾️

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq » Fri May 20, 2005 2:34 pm

3Di wrote:
(and any poll or survey that happened to be in the post)


I got the sense of your MOD now, indeed ;)

Just a question: do you know if is it compatible with CH RC5?

* not enough time to check it myself, but don't worry *


I haven't checked that, but it should fince be since I doubt that CH does anything at all to the viewtopic template once you've opened up a topic. The only thing this mod does in the regular phpbb files is to add a link to clone.php next to the quote button on each post. When you click that link, it takes you to clone.php and that is a brand new file that CH can't have messed up. So, should work with CH but once you try it let me know if I'm right about that.

User avatar
3Di
Former Team Member
Posts: 14482
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Post by 3Di » Fri May 20, 2005 2:40 pm

asinshesq wrote:
3Di wrote:
(and any poll or survey that happened to be in the post)


I got the sense of your MOD now, indeed ;)

Just a question: do you know if is it compatible with CH RC5?

* not enough time to check it myself, but don't worry *


I haven't checked that, but it should fince be since I doubt that CH does anything at all to the viewtopic template once you've opened up a topic. The only thing this mod does in the regular phpbb files is to add a link to clone.php next to the quote button on each post. When you click that link, it takes you to clone.php and that is a brand new file that CH can't have messed up. So, should work with CH but once you try it let me know if I'm right about that.


I'll let u know, testing it in my localhost first. Then I'll report ;)
Scheduled ;)
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
✒️ Black Friday 2019 @ The Studio ▪️◾️

scanar
Registered User
Posts: 10
Joined: Fri Jan 30, 2004 6:43 pm

Re: [BETA] Clone posts

Post by scanar » Tue May 31, 2005 1:12 pm

asinshesq wrote: ...see what you think:


Thanks asinshesq, I have added this to our school forum where it is very useful for, well, cloning posts. Two things I would be interested in seeing in the future are the ability to clone with attachments and also being able to only have access to clone in your own posts. Apart from that, it is a bonzer addition to phpBB functions! Thnaks!

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: [BETA] Clone posts

Post by asinshesq » Tue May 31, 2005 1:54 pm

scanar wrote: ...also being able to only have access to clone in your own posts....


Thanks for your comments. I'm unclear about what you are asking here. Are you saying that you would like to restrict the function so that a user will only be able to clone his own posts?

The following line the mod adds to viewtopic is where it figures out which users to give clone buttons to:

Code: Select all

if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD || $is_auth['auth_pollcreate'] )
As you can see, that is set up to give a clone button to any ADMIN or MOD and to any user authroized to post polls. If you have other ideas about who should be allowed or not allowed to clone posts, this is where to tinker.

So suppose that you want ADMINs and MODs to be able to clone any post but you want other users to be able to clone only their own posts. This should do the trick (though I'm not at my server now so I haven't tried it):

Code: Select all

OPEN
viewtopic.php

FIND
	if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD || $is_auth['auth_pollcreate'] )


REPLACE IWTH
	if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD || $postrow[$i]['user_id'] == $userdata['user_id'] )

Swizec
Former Team Member
Posts: 1701
Joined: Mon Mar 10, 2003 9:42 pm
Location: Slovenia
Contact:

Post by Swizec » Tue May 31, 2005 3:59 pm

I've went throught he code for this mod a bit, and my comment is, why so much code for what you could achieve by simply changing some topic and forum ids ?

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq » Tue May 31, 2005 4:10 pm

Swizec wrote: I've went throught he code for this mod a bit, and my comment is, why so much code for what you could achieve by simply changing some topic and forum ids ?


Feel free to re-write it to be shorter ;)

Seriously, the code needs to do the exact same thing that posting.php does with a number of tweaks. Instead of scattering a bunch of changes to posting.php to make this work the way it's supposed to for the clone function (which I actually did in my first draft of the mod), I decided to take the approach of making very few changes to any phpbb files and instead have a separate file (clone.php) do all hte heavy lifting. That means that clone.php replicates a lot of code that is already in posting.php. If you want to shorten things, you would get rid of clone.php altogether and make a bunch more changes to posting.php (but then the mod would be harder to install). So I opted for ease of installation and basically cloned the relevant parts of posting.php into clone.php.

As a result of this approach, there are only 5 actual changes the mod makes to phpbb files so the mod takes about 2 minutes to install even if you are doing it by hand.

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq » Thu Jun 23, 2005 1:01 am

I've uploaded a slightly revised version 1.0.1, which selects as the default target forum whichever forum the cloned post comes from (though of course the user can select any target forum he or she wants).

The only changes:

1. replace your old clone.php with the version that comes with version 1.0.1.

2. open lang_main and delete the second occurrence of the definition of $lang['Clone_post'].

theminor
Registered User
Posts: 19
Joined: Thu May 26, 2005 12:37 am

Post by theminor » Sun Jun 26, 2005 5:39 pm

Anyone (original author?) up for revising this mod slightly? Im looking for something that AUTOMATICALLY copies a post made in Forum X, Y, or Z, and puts that copy in Forum A - so users can see just posts on html, just posts on java, just posts on php, or by going to the 'base' forum they can see ALL posts.

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq » Sun Jun 26, 2005 6:29 pm

theminor wrote: Anyone (original author?) up for revising this mod slightly? Im looking for something that AUTOMATICALLY copies a post made in Forum X, Y, or Z, and puts that copy in Forum A - so users can see just posts on html, just posts on java, just posts on php, or by going to the 'base' forum they can see ALL posts.


That's not a revision...that's a totally different mod from start to finish (and I think some of it would be pretty tricky). Sorry, but since I have no use for that on my board I don't have any interest in tackling it.

If you were to try to do this, I suspect the easiest way to do it would be to tinker with viewforum and viewtopic so that whenever a user is in Forum A it would display all Forum X, Y and Z topics and posts as well as Forum A topics and posts.

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Post by asinshesq » Fri Jul 08, 2005 11:21 pm

This mod has now been validated (see http://www.phpbb.com/phpBB/viewtopic.ph ... highlight= ) ...moderators, please lock the thread.

Locked

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