News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Clone Topic

Started by nend, November 05, 2012, 02:06:59 PM

Previous topic - Next topic

nend

Link to Mod

This mod adds a new option to clone a topic to multiple boards by creating an alias or symbolic link to the original topic. This comes in handy when you want a topic to display in different boards in your forum.

How it works is by adding a new table that contains the id of the original topic and the board it is cloned to. When you visit the board a query injects the topic id into the board it is cloned into which in turn loads the topic as if it was posted in that board.

License
QuoteCopyright (c) 2012, Russell Najar (SiberInc)
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the SiberInc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Releases
0.3
- Initial release

0.4
+ Added a few missing language strings missing in the permissions under simple view.

Shambles

Might give this a whirl, though the Copy Topics mod has been good for us.

akbora

Only display or other feature?
SMF 2.0.13
Default Theme
Utf8 Turkish
---------------

nend

#3
Quote from: Shambles™ on November 05, 2012, 02:10:07 PM
Might give this a whirl, though the Copy Topics mod has been good for us.

I didn't know of that one, thought this one was a first, hmm.

*edit
Just looked at the source code for that one, the mods are different in a way of how they work. Copy Topics mod copies the entire topic and post into new tables. However Clone Topics works differently in that it only creates a reference to the original topic. Sort of like a symbolic link, so there is really no extra data and all topics in all boards update with the same information because they are sharing the same table due to the symbolic link that makes them look like they are in different boards but in truth they only exist in one.

Quote from: akbora on November 05, 2012, 06:52:13 PM
Only display or other feature?

huh

BaghdadGhost

Hi Nend,

Good job gathering this piece of modification. I have a question if you don't mind. When you clone a topic to another board does it update itself when members make replies in the original one?


Shambles

From what you say, nend, it looks like your mod creates an alias to an existing topic, which is possibly preferable to duplicating table content.

I'll give this a whirl soon and report back.

Thanks for the code.

akbora

It works like ghost topics is it right? I understand like that..
SMF 2.0.13
Default Theme
Utf8 Turkish
---------------

nend

Quote from: BaghdadGhost on November 06, 2012, 12:50:27 AM
Hi Nend,

Good job gathering this piece of modification. I have a question if you don't mind. When you clone a topic to another board does it update itself when members make replies in the original one?



All clones update at once because they are one.

Storman™

Do you know what sort of affect this has on serach engines and how they would interpret it. Or would only the original topic be indexed ?

nend

Quote from: Storman™ on November 20, 2012, 04:19:33 AM
Do you know what sort of affect this has on serach engines and how they would interpret it. Or would only the original topic be indexed ?

No different than a link on a page, search engines shouldn't treat it more differently, may make it easier to crawl since there are more links pointing to the same topic, but other than that no significant difference.

Badboy

Turkish translations. Thx.

Code (Turkish) Select
$txt['clone_topic'] = 'Konuyu Klonla';
$txt['clone_to'] = 'Şuraya klonla';
$txt['clone_remove'] = 'Kaldır';
$txt['clones_topic'] = 'Klonlar';
$txt['clones_remove'] = 'Klonları Kaldır';
$txt['modlog_ac_clone'] = 'Konu Klonlama: "{topic}"';
$txt['permissionname_clone'] = 'Konuları klonlayabilir';
$txt['permissionhelp_clone'] = 'Konuyu bir bölümden başka bir bölüme klonlar. Kullanıcılar sadece giriş izni oldukları hedef bölümleri seçebilirler.';
$txt['permissionname_clone_own'] = 'Kendi konularını';
$txt['permissionname_clone_any'] = 'Herhangi bir konuyu';
$txt['permissionname_simple_clone_own'] = 'Kendi konularını klonla';
$txt['permissionname_simple_clone_any'] = 'Herhangi bir konuyu klonla';


Code (Turkish-utf8) Select
$txt['clone_topic'] = 'Konuyu Klonla';
$txt['clone_to'] = 'Şuraya klonla';
$txt['clone_remove'] = 'Kaldır';
$txt['clones_topic'] = 'Klonlar';
$txt['clones_remove'] = 'Klonları Kaldır';
$txt['modlog_ac_clone'] = 'Konu Klonlama: "{topic}"';
$txt['permissionname_clone'] = 'Konuları klonlayabilir';
$txt['permissionhelp_clone'] = 'Konuyu bir bölümden başka bir bölüme klonlar. Kullanıcılar sadece giriş izni oldukları hedef bölümleri seçebilirler.';
$txt['permissionname_clone_own'] = 'Kendi konularını';
$txt['permissionname_clone_any'] = 'Herhangi bir konuyu';
$txt['permissionname_simple_clone_own'] = 'Kendi konularını klonla';
$txt['permissionname_simple_clone_any'] = 'Herhangi bir konuyu klonla';
Nothing is true, everything is permitted.

ViewFromTheBoundary

I am trying to install this on my forum, I am using the Vertex theme and there isnt an option to tick this at the bottom. What is the next step to try and install this on my forum?

   1.    Adapt Database    db.php    
*    2.    Execute Modification    ./index.php    Test failed
      1.    Add Before    ./index.php    Test failed
*    3.    Execute Modification    ./Themes/default/Display.template.php    Test successful
*    4.    Execute Modification    ./Themes/default/languages/Modifications.english.php    Test successful
*    5.    Execute Modification    ./Sources/ManagePermissions.php    Test successful
*    6.    Execute Modification    ./Sources/Display.php    Test successful
*    7.    Execute Modification    ./Sources/MessageIndex.php    Test successful
   8.    Extract File    ./Sources/CloneTopic.php    
   9.    Extract File    ./Themes/default/CloneTopic.template.php    

Install in Other Themes
To use this modification in themes other than the default, the package manager needs to make additional changes to the other themes. If you'd like to install this modification in the other themes, please select these themes below.
      Core Theme
      Execute Modification    ./Themes/core/Display.template.php    Test successful

For the failed test this is the edit

Code: (Find) [Select]

'credits' => array('Who.php', 'Credits'),
'deletemsg' => array('RemoveTopic.php', 'DeleteMessage'),

Code: (Add Before) [Select]

'clonetopic' => array('CloneTopic.php', 'CloneTopic'),
'clonetopic2' => array('CloneTopic.php', 'CloneTopic2'),


Any help that anyone could give to help me install this on my forum would be greatly appreciated!  :)

Hristo

This one seems easy.

Attach your index.php file

ViewFromTheBoundary

This is all that is in my index.php file

<?php

// Try to handle it with the upper level index.php. (it should know what to do.)
if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
   include (
dirname(dirname(__FILE__)) . '/index.php');
else
   exit;

?>

Neo_TE

Quote from: DomesticCricketForum on July 26, 2013, 06:10:20 AM
I am trying to install this on my forum, I am using the Vertex theme and there isnt an option to tick this at the bottom. What is the next step to try and install this on my forum?

This mod doesn't edit the index.template.php or boardindex.template.php, so there are no edits in your custom theme.

The index.php file is the one listed in the forum directory and not in the theme directory. :)

Hristo

No, not this one, but the one that is in your main forum folder - the folder which contains these folders:
attachments
avatars
cache
Packages
Smileys
Sources
Themes

Neo_TE

This mod does not work in my test forum. The topic gets cloned successfully. But it doesn't appear in the board to which the topic was cloned to. :o

ViewFromTheBoundary

Quote from: Hristo on July 26, 2013, 06:43:53 AM
No, not this one, but the one that is in your main forum folder - the folder which contains these folders:
attachments
avatars
cache
Packages
Smileys
Sources
Themes

Ah right, I will have to do it later as I'm at work currently so dont have access to the file needed. When I get home I will upload the file  :)

Hristo

I can't delete the clone. Using quick moderation delete on Message index does not work. Is this normal or the problem is only on my forum (a test forum with just a few mods installed)?

nend

Quote from: xPandax on July 26, 2013, 06:50:21 AM
This mod does not work in my test forum. The topic gets cloned successfully. But it doesn't appear in the board to which the topic was cloned to. :o
The board needs at least one topic in it that is not a clone or SMF will not do the query.
Quote from: Hristo on July 26, 2013, 09:25:30 AM
I can't delete the clone. Using quick moderation delete on Message index does not work. Is this normal or the problem is only on my forum (a test forum with just a few mods installed)?
I don't think I have tested it with quick moderation so may not work there. The moderation within the topic should work.

I haven't had much time though to do anything lately so the mod is as is. :(

Advertisement: