Link to the mod (https://custom.simplemachines.org/index.php?mod=1273)
This customization will make all future moved topic notices redirect automatically to the topics new location.
The message is still posted for the redirect topic incase you ever want to remove this customization or in process of an upgrade.
There are some minimal changes to the MessageIndex.template.php that are not needed but do make it look a bit nicer for your moved topic links by removing the useless junk such as replies, views, etc.
SMF 2.1 does this by default and this is no longer required
Thanks for the nice modification SleePy.
Installed perfectly (on a forum with 15+ mods) and works very well! :D
Is it possible to make a Version for SMF 1.1.x?
Bye
DIN1031
Not really.
This version taps into the approved and id_previous_topic columns that only exist in 2.0. Which is the reason it is able to be done so easily :)
To make a 1.1 version we would have copy the approved and id_previous_topic from 2.0 smf_topics table and use the same thing in 1.1 so upgrading to 2.0 in the future would work.
Awesome! I always saw little point in the move topic posts themselves when they should have been redirected to the new ones in the first place :P Thanks!
how
it's the gretest mod and work very well in smf 2.0 beta 3.1 public
thanks
I have a problem
when I move a topic I can't delete the topic of the redirect.
I don't know what to do!
Okay, this mod has an error, this edit from the 'Redirect_Moved_Topics-20b3p.xml' file returns some errors.
<operation>
<search position="replace"><![CDATA[ 'href' => $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . '#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . '#new" ' . ($row['num_replies'] == 0 ? '' : 'rel="nofollow"') . '>' . $row['last_subject'] . '</a>'
]]></search>
<add><![CDATA[ 'href' => $scripturl . '?topic=' . ($row['approved'] == 2 && !empty($row['id_previous_topic']) ? $row['id_previous_topic'] : $row['id_topic']) . ($user_info['is_guest'] ? ('.' . (!empty($options['view_newest_first']) ? 0 : ((int) (($row['num_replies']) / $context['pageindex_multiplier'])) * $context['pageindex_multiplier']) . '#msg' . $row['id_last_msg']) : (($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . '#new')),
'link' => '<a href="' . $scripturl . '?topic=' . ($row['approved'] == 2 && !empty($row['id_previous_topic']) ? $row['id_previous_topic'] : $row['id_topic']) . ($user_info['is_guest'] ? ('.' . (!empty($options['view_newest_first']) ? 0 : ((int) (($row['num_replies']) / $context['pageindex_multiplier'])) * $context['pageindex_multiplier']) . '#msg' . $row['id_last_msg']) : (($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . '#new')) . '" ' . ($row['num_replies'] == 0 ? '' : 'rel="nofollow"') . '>' . $row['last_subject'] . '</a>'
]]></add>
</operation>
The errors only seem to occur for guests, and they concern the lack of a $context['pageindex_multiplier'] value:
Quote
http://www.verbtest.com/index.php?board=3.0;sort=last_post
2: Division by zero
File: /******/Sources/MessageIndex.php
Line: 552
Quote
http://www.verbtest.com/index.php?board=3.0;sort=last_post
8: Undefined index: pageindex_multiplier
File: /*****/Sources/MessageIndex.php
Line: 552
Line 552 is this:
'href' => $scripturl . '?topic=' . ($row['approved'] == 2 && !empty($row['id_previous_topic']) ? $row['id_previous_topic'] : $row['id_topic']) . ($user_info['is_guest'] ? ('.' . (!empty($options['view_newest_first']) ? 0 : ((int) (($row['num_replies']) / $context['pageindex_multiplier'])) * $context['pageindex_multiplier']) . '#msg' . $row['id_last_msg']) : (($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . '#new')),
Have a look at this thread for reference:
http://www.simplemachines.org/community/index.php?topic=253916.new#new (http://www.simplemachines.org/community/index.php?topic=253916.new#new)
thanks man
it's work very well
@Sleepy, that package manager says that the file is corrupted, could you re-upload it again?
I repackaged the file and reuploaded it. Try again :)
Awesome! thank you!! installed perfectly, and looks very nice!
Quote from: Rocks-HD on July 31, 2008, 01:13:48 PM
I have a problem
when I move a topic I can't delete the topic of the redirect.
I don't know what to do!
Go to Forum Maintenance>Remove Old Posts>Moved topic notices.
Hi. How can i replace that:
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0', 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['first_subject'] . '</a>'
to that code:
'href' => $scripturl . '?topic=' . ($row['approved'] == 2 && !empty($row['id_previous_topic']) ? $row['id_previous_topic'] : $row['id_topic']) . '.0', 'link' => '<a href="' . $scripturl . '?topic=' . ($row['approved'] == 2 && !empty($row['id_previous_topic']) ? $row['id_previous_topic'] : $row['id_topic']) . '.0">' . $row['first_subject'] . '</a>'
when my template have this code:
'href' => $scripturl . '?topic=' . ($row['approved'] == 2 && !empty($row['id_previous_topic']) ? $row['id_previous_topic'] : $row['id_topic']) . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0"' . $row['nice_tooltip_first_msg'] . ' >' . $row['first_subject'] . '</a>'
?
great mod SleePy ;D , specially for a guy like me who's mods are very lazy , they always leave tails of posts on boards .
frozenas,
It looks like the code was already applied to that section of code.
Please update to RC5 :)
Is this mod still in development?
If it is I would like to brink to attention that although it says it is compatible with version 2.0 I get at least 5 errors when trying to install it on a regular SMF board
What are the errors you get?
In ./Sources/Subs-Post.php
Find
'id_poll' => 'int', 'unapproved_posts' => 'int', 'approved' => 'int',
Replace
'id_poll' => 'int', 'unapproved_posts' => 'int', 'approved' => 'int',
// Add this in for Moved Redirction Topics.
'id_previous_topic' => 'int',
Find
$topicOptions['poll'] === null ? 0 : $topicOptions['poll'], $msgOptions['approved'] ? 0 : 1, $msgOptions['approved'],
Replace
$topicOptions['poll'] === null ? 0 : $topicOptions['poll'], $msgOptions['approved'] ? 0 : 1, $msgOptions['approved'],
// Tell it where to send the Moved Redirect Topic, maybe.
!empty($topicOptions['id_previous_topic']) ? $topicOptions['id_previous_topic'] : 0,
Then in ./Themes/default/MessageIndex.template.php
Find
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
Replace
', !$topic['is_moved_redirect'] ? '<img src="' . $settings['images_url'] . '/topic/' . $topic['class'] . '.gif" alt="" />' : '' ,'
Find
<img src="', $topic['first_post']['icon_url'], '" alt="" />
Replace
', !$topic['is_moved_redirect'] ? '<img src="' . $topic['first_post']['icon_url'] . '" alt="" />' : '', '
Find
// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
Replace
// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'] && !$topic['is_moved_redirect'])
Find
', $topic['replies'], ' ', $txt['replies'], '
Replace
', $topic['is_moved_redirect'] ? '--' : $topic['replies'] . ' ' . $txt['replies'], '
Find
', $topic['views'], ' ', $txt['views'], '
Replace
', $topic['is_moved_redirect'] ? '--' : $topic['views'] . ' ' . $txt['views'], '
Find
<a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a>
', $topic['last_post']['time'], '<br />
', $txt['by'], ' ', $topic['last_post']['member']['link'], '
Replace
', $topic['is_moved_redirect'] ? '--' : '<a href="' . $topic['last_post']['href'] . '"><img src="' . $settings['images_url'] . '/icons/last_post.gif" alt="' . $txt['last_post'] . '" title="' . $txt['last_post'] . '" /></a>
' . $topic['last_post']['time'] . '<br />
' . $txt['by'] . ' ' . $topic['last_post']['member']['link'], '
Now the weird thing is I can find all of those code segments in the corresponding files but the package won't install no matter what. Does this mean I have to do it manually?
What other mods do you have installed, more than likely the target code has been edited by another mod, you can try to manually edit the files if you'd like
Manual Installation of Mods (http://wiki.simplemachines.org/smf/Manual_installation_of_mods)
Actually the errors are there on a fresh install as well.
I considered that as an option so I did a vanilla install on my private server and got the same thing.
PM me if you want to access the test forum and see what I am talking about
seems we both figured that one out
I checked the mod itself it's the number of indentations that are incorrect... for example
<a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a>
', $topic['last_post']['time'], '<br />
', $txt['by'], ' ', $topic['last_post']['member']['link'], '
should be <a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a>
', $topic['last_post']['time'], '<br />
', $txt['by'], ' ', $topic['last_post']['member']['link'], '
really its that sensitive!?
this makes sense I guess since I use the search option in Dreamweaver to ignore white-space
well I can modify the xml so it works with the default but have had no luck with the core theme
I've attached my modified package that works for now but will leave it up to the developer if they want to continue with it
Hello guys! Do you have any update to this MOD?
Hugs!
I can't delete the moved topic thingies.
There is another problem with this mod (apart from the fact that you can only delete moved topic notices through the backend (http://www.simplemachines.org/community/index.php?topic=246230.msg2561544#msg2561544)):
The moved topic notice (the redirector) is marked unread for anyone but the topic mover. And it is rather difficult to change that state. You cannot go into the topic and marking it as read via checkbox on the topic table doesn't work either for some reason. The only way is to mark ALL read (this can be within a subforum scope).
Which makes me think that a little Javascript redirect inside the topic notice would solve redirection more gracefully.
Quote from: Kolya on February 09, 2015, 03:03:12 PM
Which makes me think that a little Javascript redirect inside the topic notice would solve redirection more gracefully.
In Source/MoveTopic.php:
FIND
$txt['movetopic_auto_topic'] => '[iurl]' . $scripturl . '?topic=' . $topic . '.0[/iurl]'
REPLACE WITH
$txt['movetopic_auto_topic'] => '[iurl]' . $scripturl . '?topic=' . $topic . '.0[/iurl]
Redirecting....<script>var mtu = document.getElementsByClassName("bbc_link");setInterval(function(){window.location = mtu[mtu.length-1].innerHTML;},2000);</script>'
I have removed my own script (above) from my boards today. It was causing a problem in lists of posts where the redirecting thread appears including its post text and redirection script. The whole listing page was unintentionally redirected in this case. An example of such a list is Posts made by a user and possibly search results.
I have therefore replaced this script with this mod by Arantor (http://custom.simplemachines.org/mods/index.php?mod=2257) which allows to redirect the user as well as setting an expiry date on the redirection topic.