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.

Rating:

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

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

Post by asinshesq » Thu Nov 24, 2005 2:07 pm

mikedean2 wrote: ...Im convinced the error isnt in index.php or viewforum.php. What the hell did I do :oops:

No idea. Let's move the discussion about the auto-shadow mod to the new topic I created here: http://www.phpbb.com/phpBB/viewtopic.ph ... 42#1872742 since this has nothing to do with the clone posts mod.

mikedean2
Registered User
Posts: 199
Joined: Thu Feb 26, 2004 8:22 pm

Post by mikedean2 » Thu Nov 24, 2005 2:08 pm

REMOVED
Last edited by mikedean2 on Fri Nov 25, 2005 4:01 pm, edited 1 time in total.

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

Post by asinshesq » Thu Nov 24, 2005 2:10 pm

mikedean2 wrote: this is the error I got before I removed that index edit when moving the posts:

Parse error: parse error, unexpected T_LOGICAL_AND in /home/theminor/public_html/index.php on line 191

Let's do this by pm since it is not relevant for the clone mod.

Let me know in a pm what appears in and around line 191 of yyour index.php.

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

Post by asinshesq » Mon Dec 05, 2005 10:05 am

[Note: the following question was by pm but I am quoting it here so others can get the benefit of the answer]
RaoulDuke wrote: I run a film forum that I would like to use the tabulated survey mod for my users to get feedback on their scripts. Obviously, the clone posts mod would make this awesome, since they could just use the pre-existing "template" of the survey that we've already made...

great idea!
RaoulDuke wrote: ...What I'm wondering is:

1. Is there a way to use the clone post mod so that only surveys can be cloned? In other words, not posts or polls, just surveys?

2. Is there any way to only allow specific surveys to be cloned? In other words, I want this script review survey to be easily duplicatible, but I don't want the list to get junked up by other surveys.

Thanks for your help!


Yes, that would be easy to do. There is a place in the clone mod with the following instructions:

Code: Select all

#
#-----[ OPEN ]------------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------------
#
	$quote = '<a href="' . $temp_url . '">' . $lang['Reply_with_quote'] . '</a>';

#
#-----[ AFTER, ADD ]------------------------------------------------
#
	// start mod clone posts
	if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD || $is_auth['auth_pollcreate'] )
	{
		$temp_url = append_sid("clone.$phpEx?" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
		$clone_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_clone'] . '" alt="' . $lang['Clone_post'] . '" title="' . $lang['Clone_post'] . '" border="0" /></a>';
	}
	else $clone_img = '';
	// end mod clone posts
All you would need to do is to tinker with that if statement. Here are some possibilities for how to restrict people so that they can clone only a single post that has your script template in it (xyz in each case is the post_id of the post that has your script template in it)::

1. If you want admins or moderators to be able to clone anything and other users who are authorized to post polls to be able to clone only the post with your script template, use this:

Code: Select all

	if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD || ($is_auth['auth_pollcreate'] && $postrow[$i]['post_id'] == xyz) )
2. If you want admins or moderators to be able to clone anything and all other users to be able to clone only the post with your script template, use this:

Code: Select all

	if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD || $postrow[$i]['post_id'] == xyz )
3. If you want admins to be able to clone anything and other users who are authorized to post polls to be able to clone only the post with your script template, use this:

Code: Select all

	if ( $userdata['user_level'] == ADMIN || ($is_auth['auth_pollcreate'] && $postrow[$i]['post_id'] == xyz) )

4. If you want admins to be able to clone anything and all other users to be able to clone only the post with your script template, use this:

Code: Select all

	if ( $userdata['user_level'] == ADMIN || $postrow[$i]['post_id'] == xyz )
5. If you want all users (regardless of whether they are admins) to be able to clone only the post with your script template, use this:

Code: Select all

	if ( $postrow[$i]['post_id'] == xyz )
Obviously there are other permutations as well.

Make sure you carefully read the author's notes to this mod, since there are special things you need to do to make this mod work properly with my tabulated surveys mod.

RaoulDuke
Registered User
Posts: 19
Joined: Tue Sep 06, 2005 3:17 am
Location: St. Louis
Contact:

Post by RaoulDuke » Mon Dec 05, 2005 11:30 am

Thanks a bunch. I've already got the clone and survey mods working fine together, this should be an easy adjustment. You rock!

Sorry PMed you instead of posting here too. I thought my problem was too specific. :oops:

Anyway, I appreciate it immensly. Great mods!

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

Post by asinshesq » Mon Dec 05, 2005 11:49 am

RaoulDuke wrote: ...I've already got the clone and survey mods working fine together, this should be an easy adjustment...

Glad to hear you've got things up and running already. Are you using the very latest versions of the survey and clone mods? The latest clone mod version (1.0.3a) has a feature you probably won't need (it allows admins to clone in the original poster's name) but the recently added features of the survey mod (now on version 1.0.15) are actually pretty useful (see the third post in the survey topic for a download link to the latest version, which I haven't yet submitted for validation).
RaoulDuke wrote: ...Sorry PMed you instead of posting here too. I thought my problem was too specific....

No problem. I just think it's useful for everyone to see the questions and answers. And your particular use, precisely because it is unusual, is a great thing to add to the string (it may give other people ideas about how to use these kinds of mods).

RaoulDuke
Registered User
Posts: 19
Joined: Tue Sep 06, 2005 3:17 am
Location: St. Louis
Contact:

Post by RaoulDuke » Tue Dec 06, 2005 5:16 am

Yes, I'm using the latest versions, thanks. :D

So, my modified code looks like this:

Code: Select all

// start mod clone posts
	if ( $postrow[$i]['post_id'] == 379 )
	{
		$temp_url = append_sid("clone.$phpEx?" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
		$clone_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_clone'] . '" alt="' . $lang['Clone_post'] . '" title="' . $lang['Clone_post'] . '" border="0" /></a>';
	}
	else $clone_img = '';
	// end mod clone posts
And now no one has the ability to clone anything, including the post I'm referencing...

As I change the code to the above examples, the difference becomes that admins and moderators can clone pretty much anything, but regular users can't clone anything, including the specified post.

Am I doing something wrong? Thanks for your help, I really do appreciate it. :D

My only other question would be whether it's possible to remove the "fill out survey for another user" option, as I don't really want my users to be able to do that...I think I could figure it out myself but I wanted to ask before I really screwed something up.

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

Post by asinshesq » Tue Dec 06, 2005 11:33 am

RaoulDuke wrote: ...So, my modified code looks like this:

Code: Select all

// start mod clone posts
	if ( $postrow[$i]['post_id'] == 379 )
	{
		$temp_url = append_sid("clone.$phpEx?" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
		$clone_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_clone'] . '" alt="' . $lang['Clone_post'] . '" title="' . $lang['Clone_post'] . '" border="0" /></a>';
	}
	else $clone_img = '';
	// end mod clone posts
And now no one has the ability to clone anything, including the post I'm referencing...

More details,please. Are you really sure you are talking about post 379? The number you need to use is the post number, not the topic number.

Do the regular users see the clone link when they view post #379 in viewtopic after you change the if statement to:

Code: Select all

if ( $postrow[$i]['post_id'] == 379 )
?
RaoulDuke wrote: ...My only other question would be whether it's possible to remove the "fill out survey for another user" option, as I don't really want my users to be able to do that...I think I could figure it out myself but I wanted to ask before I really screwed something up.

Yes, that's covered in the author's notes for the mod. Just delete or comment out the following in clone.php:

Code: Select all

if( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD )
{
	$template->assign_block_vars('switch_include_option_to_post_using_name_of_original_poster', array());
}

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

Post by asinshesq » Tue Dec 06, 2005 11:50 am

RaoulDuke, here's an update: I just actually tried the code I gave you on my board (the one with the simple if statement) and it works fine, so I'm guessing you have the wrong post_id. Make sure you are using the post id and NOT the topic id.

RaoulDuke
Registered User
Posts: 19
Joined: Tue Sep 06, 2005 3:17 am
Location: St. Louis
Contact:

Post by RaoulDuke » Tue Dec 06, 2005 11:55 am

Shoot, I'm an idiot. I input the topic number. The post number is 2767. Sorry. :oops:

Also, didn't catch that little change in the MOD file. Sorry again. :oops:

You're incredibly patient, thanks for that. Everything works great now. I owe you a beer. :D

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

Post by asinshesq » Tue Dec 06, 2005 12:10 pm

RaoulDuke wrote: ...You're incredibly patient, thanks for that. Everything works great now. I owe you a beer. :D

Next time I'm in St. Louis ;)

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

Post by asinshesq » Sun Dec 11, 2005 9:52 pm

I just uploaded a new version 1.0.4 of this mod, whidch you can get here:
http://asinshesq.dynalias.com/clone_posts_1-0-4.zip

Here's the changelog since 1.0.2 (the last validated version):

Code: Select all

##   2005-12-11	- Version 1.0.4
##		  changed code so that by default (a) the users who are authorized to create polls in a forum are the only  
##		  ones who can clone posts in that forum and (b) admins or moderators in a forum are the only ones who can clones posts
##		  in that forum in the name of the original poster.  Also updated the instructions a bit.
##
##		  added a mod to the mod in the contrib folder that will allow the admin to set cloning permissions in the ACP
##		  in the same way the admin can fine tune permissions for other phpbb actions
##
##   2005-11-19	- Version 1.0.3a
##		  fixed code so that when you create the new post in original poster's name and then try to preview the 
##		  post, it remembers that you are posting in original poster's name
##
##   2005-11-13	- Version 1.0.3
##		  added feature that allows admin to decide whether to create the new cloned post in the name of original poster
##		  or in the name of the user doing the cloning
I plan to submit this for validation next week if I don't get sidetracked.

fshagan
Registered User
Posts: 169
Joined: Mon Dec 09, 2002 1:41 am
Location: California
Contact:

Post by fshagan » Thu Dec 29, 2005 4:14 am

Hi asinshesq, this is a mod I've been looking for! I downloaded the latest approved version, 1-0-2, and installed it. It worked. Then I downloaded the 1-0-4 version to get the all important (to me!) ability to clone the post using the original author's name. Can't get it to work.

There's no clone gif icon shown, so I thought perhaps it was the change I made to the first modifcation of VIEWTOPIC.PHP, where I changed the line to:

Code: Select all

if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD )
But changing it back to the default:

Code: Select all

if ( $is_auth['auth_pollcreate'] )
And I still can't get it to work. Any ideas?

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

Post by asinshesq » Thu Dec 29, 2005 8:41 am

fshagan wrote: Hi asinshesq, this is a mod I've been looking for! I downloaded the latest approved version, 1-0-2, and installed it. It worked. Then I downloaded the 1-0-4 version to get the all important (to me!) ability to clone the post using the original author's name. Can't get it to work.

There's no clone gif icon shown, so I thought perhaps it was the change I made to the first modifcation of VIEWTOPIC.PHP, where I changed the line to:

Code: Select all

if ( $userdata['user_level'] == ADMIN || $userdata['user_level'] == MOD )
But changing it back to the default:

Code: Select all

if ( $is_auth['auth_pollcreate'] )
And I still can't get it to work. Any ideas?

Well, the problem you are describing has to be in viewtopic.php, but the two versions of the mod make identical changes to viewtopic.php except for the one line you quote.

The first line you quote will only show the clone icon for a user who is an admin or moderator, while the second one (the default from the current version of the mod) will allow anyone who is allowed to post a poll to clone a post. No reason that shouldn't work unless you have some other difference in viewtopic.php that has nothing to do with this mod, but since you said version 1.0.2 of this mod worked fine that seems unlikely unless you made other changes in the interim.

Did you use easymod to install? If not, maybe you forgot to make the required changes to viewtopic_body.tpl for any non-subSilver templates you are using (or to copy icon_clone.gi for any non-subSilver templates and non-English languages you are using)? You need to make those changes for all your templates and languages.

fshagan
Registered User
Posts: 169
Joined: Mon Dec 09, 2002 1:41 am
Location: California
Contact:

Post by fshagan » Thu Dec 29, 2005 6:18 pm

Thanks! It appears to be working now. I had a "parse error" in posting.php, but even after fixing that, I couldn't get it to work. Your comment helped ... the main problem was that my editor on my laptop converted the "viewtopic_body.tpl" file into one of its "known file types" and changed it to "viewtopic_body.PHP". No wonder I couldn't see the little icon!

It seems to be working well. I'm very happy to find this mod.

Post Reply

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

Who is online

Users browsing this forum: No registered users and 10 guests