Clone posts

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply

Rating:

Excellent!
8
62%
Very Good
4
31%
Good
1
8%
Fair
0
No votes
Poor
0
No votes
 
Total votes: 13

Extensions Robot
Extensions Robot
Extensions Robot
Posts: 27340
Joined: Sat Aug 16, 2003 7:36 am

Clone posts

Post by Extensions Robot » Thu Jun 23, 2005 12:54 am

Modification name: Clone posts
Author: asinshesq
Modification description: Allows a user to clone a post to a new topic that can be placed in any forum. This is especially useful for cloning non-standard posts like posts with polls in them (or even better, posts with surveys in them created using my tabulated survey at topic head mod), since those posts are not so easy to copy without a mod like this.
Modification version: 1.0.6
Tested on phpBB version: See below

Download file: clone_posts_1-0-6.zip
File size: 26014 Bytes

Modification overview page: View


Selected tags:
  1. category
    1. Add-Ons
  2. phpbb
    1. 2.0.21
    2. 2.0.22
Support for this modification needs to be asked within this topic. The phpBB Team is not responsible or required to give anyone support for this modification. By installing this MOD, you acknowledge that the phpBB Support Team or phpBB MODifications Team may not be able to provide support.

This MOD has only been tested by the phpBB MOD Team with the phpBB version listed in the topic. It may not work in any other versions of phpBB.
Last edited by Extensions Robot on Sat Aug 04, 2007 9:28 am, edited 2 times in total.
(this is a non-active account manager for the phpBB Extensions Team)

User avatar
ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 » Fri Jul 08, 2005 1:58 pm

MOD Validated/Released

Notes:
This MOD adds a new feature which allow a post to be "cloned" to another forum (in the same phpBB forum) by users.

User avatar
»»EDDY««
Registered User
Posts: 220
Joined: Mon Jun 02, 2003 10:14 am
Location: Poland/Slupsk
Contact:

Post by »»EDDY«« » Fri Jul 08, 2005 7:02 pm

Very thanks.
Make a Tiny URL in excellent domain heh.pl


cooling system & water cooling

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:18 pm

Thanks for validating that, Mac. Hope people find this useful.

This mod allows a user to clone a post to a new topic that can be placed in any forum. 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 that uses my tabulated survey at topic head mod ( 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.
Last edited by asinshesq on Tue Jan 03, 2006 5:03 pm, edited 3 times in total.

User avatar
Zenandrar
Registered User
Posts: 146
Joined: Sat Aug 14, 2004 3:42 am

Post by Zenandrar » Tue Jul 12, 2005 12:57 am

Nice mod, I was just looking for that! Thanks for the work. :)

asinshesq, you say on install instructions:

Code: Select all

...if you only want ADMINS, MODS or the author of a given post to be
allowed to clone that post, you could change the first line to:

if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD || $postrow[$i]['user_id'] == $userdata['user_id'] )
And if I want only admin and mods to be allowed to clone?

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

Post by asinshesq » Tue Jul 12, 2005 2:26 am

Zenandrar wrote: ...And if I want only admin and mods to be allowed to clone?


OK, then change that line to:

Code: Select all

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

User avatar
Zenandrar
Registered User
Posts: 146
Joined: Sat Aug 14, 2004 3:42 am

Post by Zenandrar » Tue Jul 12, 2005 2:43 am

Great, thanks again!

User avatar
ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 » Fri Jul 15, 2005 12:58 pm

MOD Updated to version 1.0.1a
See first post for Download Link

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

Post by asinshesq » Fri Jul 15, 2005 1:43 pm

Thanks, Mac.

Sorry for any confusion here, but version 1.0.1a and 1.0.1 are actually identical (1.0.1a simply cleans up the mod script a little without making any real coding chagnes except for fixing a small typo in a comment). So if you already have 1.0.1 installed don't worry about updating to 1.0.1a.

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

Post by asinshesq » Sat Jul 30, 2005 6:23 pm

If any of you are using this mod to clone posts with surveys in them created by my tabulated survey at topic head mod, note that the existing version of clone.php does not recognize the new fields that the newest version of the survey mod (version 1.0.12) uses...I plan to re-write the clone mod so that in the future when I add fields they will automatically get picked up by the clone mod, but in the meantime you can get a revised version of clone.php that will work properly with version 1.0.12 of the survey mod here:
[edit: see my post dated august 28 below...I have now written a new version which is now available ... I plan to submit that version for validation some time in the first week of September.

[2nd edit: version 1.0.2 has now been validated and is available for download from the first post of this topic]
Last edited by asinshesq on Wed Sep 14, 2005 1:01 pm, edited 2 times in total.

User avatar
otseng
Registered User
Posts: 160
Joined: Wed Feb 04, 2004 6:51 pm
Location: Atlanta, GA
Contact:

Post by otseng » Mon Aug 01, 2005 11:11 am

Is there a way to keep the original author of the post?

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

Post by asinshesq » Mon Aug 01, 2005 12:00 pm

otseng wrote: Is there a way to keep the original author of the post?
yes, just a few small changes (or more extensive changes that I have no desire to code if you want to give the user the option to post in his name or the original poster's name), but why do you want users to be able to pose as other users? Doesn't make sense to me.
Are you sure you're not really just talking about moving a post but leaving a shadow behind (which phpbb already allows the admin to do)?

User avatar
otseng
Registered User
Posts: 160
Joined: Wed Feb 04, 2004 6:51 pm
Location: Atlanta, GA
Contact:

Post by otseng » Mon Aug 01, 2005 12:41 pm

asinshesq wrote: Are you sure you're not really just talking about moving a post but leaving a shadow behind (which phpbb already allows the admin to do)?

What I'd like to do is close a long thread, but leave the original post in place. So, if SusieQ starts a thread, then it becomes 100 pages long, then I can close it. Clone the original post and then it looks like the original thread that SusieQ started. There are a couple of reasons for this. One is that people will see that SusieQ started it, rather than me. Also, I have the Cash mod installed, so she can continue to get cash for starting that thread.

I don't need the option to select between the original poster and the cloner.

User avatar
otseng
Registered User
Posts: 160
Joined: Wed Feb 04, 2004 6:51 pm
Location: Atlanta, GA
Contact:

Post by otseng » Tue Aug 02, 2005 1:30 am

Thanks for your PM. The code you gave me was pretty close. I made a couple of changes and voila, it worked. Thanks! :)

Code: Select all

OPEN 
clone.php 

FIND (actual line is longer) 
$sql = "SELECT f.forum_name, f.forum_status, 

IN-LINE FIND 
p.post_username, 

IN-LINE REPLACE WITH 
p.poster_id, 

FIND 
$hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />'; 

AFTER, ADD 
$old_user_id = $post_info['poster_id']; 
$hidden_form_fields .= '<input type="hidden" name="clone" value="' . $old_user_id . '" />'; 

OPEN 
posting.php 

FIND (actual line is longer) 
$params = array('submit' => 'post', 'preview' => 'preview', 

IN-LINE FIND 
'preview' => 'preview', 

IN-LINE AFTER, ADD 
'clone' => 'clone', 

FIND (actual line is longer) 
         prepare_post($mode, $post_data, 

BEFORE, ADD 
         if ( $clone ) 
         { 
            $post_data['poster_id'] = $clone; 
            $sql = "SELECT username FROM " . USERS_TABLE . " 
                  WHERE user_id = $clone"; 
            if ( $result = $db->sql_query($sql) ) 
            { 
               $row = $db->sql_fetchrow($result); 
               $username = $row['username']; 
               $userdata['user_id'] = $clone;
	       $userdata['username'] = $username;
               $db->sql_freeresult($result); 
            } 
         else message_die(GENERAL_MESSAGE, $lang['No_such_user']); 
          }

FIND 
         $user_id = ( $mode == 'reply' || $mode == 'newtopic' ) ? $userdata['user_id'] : $post_data['poster_id']; 

AFTER, ADD 
         $user_id = ( !$clone ) ? $user_id : $clone; 

FIND 
      $page_title = $lang['Post_a_new_topic']; 
      $hidden_form_fields .= '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" />'; 

AFTER, ADD 
      if ( $clone ) 
      { 
         $hidden_form_fields .= '<input type="hidden" name="clone" value="' . $clone . '" />'; 
      } 

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

Post by asinshesq » Sun Aug 28, 2005 4:10 pm

As promised, I've re-written the mod so that it will be more flexible in the future in working properly with other mods that add new fields to posts. The re-write also makes the mod much much shorter.

If you want to give this a try, you can download it here:
[edit: the new version (1.0.2) has now been validated and is available for download from the first post of this topic]

I've included in a contrib folder an upgrade script that will take you from 1.0.1 or 1.0.1a to 1.0.2, and you can use easymod to do that.

If you're using my tabulated survey at topic head mod, follow the author's notes in the mod for the 4 extra changes you need to make to ensure that you can clone surveys with no problem.

Let me know if all seems to work ok (it seems fine on my live board)...I plan to submit the new version for validation in about a week.
Last edited by asinshesq on Wed Sep 14, 2005 1:02 pm, edited 1 time in total.

Post Reply

Return to “[2.0.x] MOD Database Releases”

Who is online

Users browsing this forum: No registered users and 18 guests