How to edit "This thread has been moved" Template

Started by PierreP_whited00r_com, August 26, 2013, 11:58:28 PM

Previous topic - Next topic

PierreP_whited00r_com

This old post is still valid in SMF 2.0.4:

Quote from: shadow82x on October 20, 2007, 02:58:01 PM
Quote from: Facing the facts on October 20, 2007, 02:49:10 PM
What page is this located on in the site - I would like to edit the text.
Do you mean the text of it?

In /Themes/Default/Languages/index.english.php

you should see

$txt['movetopic_default'] = 'This topic has been moved to ' . $txt['movetopic_auto_board'] . ".\n\n" . $txt['movetopic_auto_topic'];

Line 638 :: And you may customize that.

Now the end result of the Move Topic feature is with a keyword link to the board but with only a URL link to the moved thread like this:

QuoteThis topic has been moved to the forum board: Free Forum! - Everything Off Topic Elsewhere Goes Here!

http://www.whited00r.com/forum/index.php?topic=9426.0

Is it possible to have automatically a keyword link to the moved thread like this instead?

QuoteThis topic has been moved to the forum board: Free Forum! - Everything Off Topic Elsewhere Goes Here!.

iPod Touch 2G MC Model iOS 3.1.3 custom FW bugs

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

PierreP_whited00r_com

#2
Quote from: Kindred on August 27, 2013, 12:11:26 AM
not without much more coding.

That's too bad.  :-\

Would the file to be modified be /Themes/default/MoveTopic.template.php?

The problem is [TOPIC LINK] that shows only the URL instead of a keyword link like [BOARD].  :'(

This topic has been moved to [BOARD].

[TOPIC LINK]


In /Themes/Default/Languages/index.english.php

646 $txt['movetopic_auto_board'] = '[BOARD]';
647 $txt['movetopic_auto_topic'] = '[TOPIC LINK]';
648 $txt['movetopic_default'] = 'This topic has been moved to ' . $txt['movetopic_auto_board'] . ".\n\n" . $txt['movetopic_auto_topic'];

Kindred

I understand what you meant and what you want to do... but it's not that simple.... you can't just put [BOARD] in a text string... because [BOARD] is not actually defined. It would require a lookup into the board table in the database.

The topic name is yet another thing completely and would require yet another table lookup in yet another table
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

PierreP_whited00r_com

Quote from: Kindred on August 27, 2013, 07:44:21 AM
I understand what you meant and what you want to do... but it's not that simple.... you can't just put [BOARD] in a text string... because [BOARD] is not actually defined. It would require a lookup into the board table in the database.

The topic name is yet another thing completely and would require yet another table lookup in yet another table

[BOARD] works and creates a keyword link using the title of the destination board as illustrated above because it uses the board's name you have to select in the Move Topic window as illustrated below.

I know nothing about scripts & coding so I will have to believe you that is is not possible (or difficult) for [TOPIC LINK] to include the moved thread's title besides it's URL.  :'(

What would be the manual way to make a keyword link? Would this work:

[url=TOPIC LINK]NAME OF MOVED THREAD[/url]

Currently my workaround is to create the new Moved thread then edit it to replace the plain URL with a keyword linked one.

margarett

I want to take a look at this, but not today as it was a hard, hard day.
Anyway, is it really worth it for you? The subject of the "moved" topic includes the original topic name.

If you think it's really worth it, I will take a look.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

PierreP_whited00r_com

#6
Quote from: margarett on September 02, 2013, 06:27:48 PM
I want to take a look at this, but not today as it was a hard, hard day.
Anyway, is it really worth it for you? The subject of the "moved" topic includes the original topic name.

If you think it's really worth it, I will take a look.

"...it was a hard, hard day" - Hope you get a better one tomorrow.  ;)

"...If you think it's really worth it, I will take a look." - Yes please if it is not to much trouble. It should be the default behavior in the next SMF IMO because:

1- Current This topic has been moved to BOARD NAME in the post does not say to users that they are clicking on a board link and NOT on the link to the moved thread. It should be This topic has been moved to this board: [board] for example.

Or even better: The topic [KEYWORD LINK TO TOPIC] has been moved to this board: [BOARD]

2- Users tend to click on keyword link to board instead of plain URL below it.

3- It is much better for SEO to use keyword links instead of plain URL.

Maybe it could be an addon?

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

PierreP_whited00r_com

Quote from: margarett on September 02, 2013, 07:31:29 PM
Ty ;) Will have a look tomorrow

Or a couple of days after tomorrow, no rush.  ;)

Have you seen my edit above?

Or even better: The topic [KEYWORD LINK TO TOPIC] has been moved to this board: [BOARD]

margarett

I have to see what does the function do. All the contents are there, so I think it should be a matter of display.
But I might be totally wrong :P

I need to check ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair


PierreP_whited00r_com

#11
Quote from: margarett on September 02, 2013, 07:39:33 PM
I have to see what does the function do. All the contents are there, so I think it should be a matter of display...

That's what I thought too as the moved topic title is used in the new Moved topic's title.

Quote from: Liam_michael on September 02, 2013, 10:42:59 PM
Check this out: http://custom.simplemachines.org/mods/index.php?mod=708

Thank you that is interesting. 8)

But is says:

QuoteFeatures:
o Notify the author of his topic has been moved by PM.
o The PM Notification option does not show up for own topics, or topics posted by guests!
o Simple and friendly interface to set the PM Body.
o Easy to use commands like {topic}, {prev_board}, {subject} and {board}.

Compatible with 2.0...

I thought the OP is already notified of the move in SMF 2.04 if > Profile > Notifications > options enabled like we turn on by default. OTOH the OP can opt-out of that if he wants.

And the only lonely :'( screen capture is about the PM "Notification text" & not about what the new Moved topic looks like:

margarett

That's because that's what the MOD does, PM on topic moved :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

PierreP_whited00r_com

Quote from: margarett on September 03, 2013, 08:26:57 AM
That's because that's what the MOD does, PM on topic moved :P

As I said above I am not a programmer but in that Mod page when you parse Manual Install Instructions for SMF 2.0.5 does it not give some clues that could be useful for what I would like to do?

margarett

No... The parse gives you the installation instructions for the MOD, in human-understandable language :)
So, it tells you what to do "by hand", what the installer does automatically.

It is therefore unlikely that the instructions for manual installation of a certain MOD will explain you what to do for another, more-or-less-related change that you want to do.

You should look for the actual source code of the "move" action, see how it performs actually and check if you can adapt it to your needs. That's what I do :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

I am now a little bit lost on what you wish :P Sorry about that, long days.

Anyway,as I suspected, this is really quite simple. All the information is already here, so we just need to display it.

Have a look in Sources/MoveTopic.php, specifically this part here:

if (isset($_POST['postRedirect']))
{
// Should be in the boardwide language.
if ($user_info['language'] != $language)
loadLanguage('index', $language);

$_POST['reason'] = $smcFunc['htmlspecialchars']($_POST['reason'], ENT_QUOTES);
preparsecode($_POST['reason']);

// Add a URL onto the message.
$_POST['reason'] = strtr($_POST['reason'], array(
$txt['movetopic_auto_board'] => '[url=' . $scripturl . '?board=' . $_POST['toboard'] . '.0]' . $board_name . '[/url]',
$txt['movetopic_auto_topic'] => '[iurl]' . $scripturl . '?topic=' . $topic . '.0[/iurl]'
));

$msgOptions = array(
'subject' => $txt['moved'] . ': ' . $subject,
'body' => $_POST['reason'],
'icon' => 'moved',
'smileys_enabled' => 1,
);
$topicOptions = array(
'board' => $board,
'lock_mode' => 1,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $user_info['id'],
'update_post_count' => empty($pcounter),
);
createPost($msgOptions, $topicOptions, $posterOptions);
}


Easy, right? ;)

So, for the easy part: if you want to have the complete URL of the new topic (not only link, but name+link),
find:

// Add a URL onto the message.
$_POST['reason'] = strtr($_POST['reason'], array(
$txt['movetopic_auto_board'] => '[url=' . $scripturl . '?board=' . $_POST['toboard'] . '.0]' . $board_name . '[/url]',
$txt['movetopic_auto_topic'] => '[iurl]' . $scripturl . '?topic=' . $topic . '.0[/iurl]'

And replace with:

// Add a URL onto the message.
$_POST['reason'] = strtr($_POST['reason'], array(
$txt['movetopic_auto_board'] => '[url=' . $scripturl . '?board=' . $_POST['toboard'] . '.0]' . $board_name . '[/url]',
$txt['movetopic_auto_topic'] => '[iurl=' . $scripturl . '?topic=' . $topic . '.0] ' .$subject . '[/iurl]'

And there you go, a very nice link to the new topic :P

What I don't know and couldn't find, is how that "[TOPIC LINK]" relates to any of this :P
In the end, we can be able to customise the layout of the new topic but not relate it to the options given to the person who moves the topic...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

Quote from: PierreP_whited00r_com on September 02, 2013, 07:24:02 PM
Or even better: The topic [KEYWORD LINK TO TOPIC] has been moved to this board: [BOARD]
If you want this default text, you can easily edit index.english.php and change this:

$txt['movetopic_default'] = 'This topic has been moved to ' . $txt['movetopic_auto_board'] . ".\n\n" . $txt['movetopic_auto_topic'];

To something like:

$txt['movetopic_default'] = 'The topic ' . $txt['movetopic_auto_topic'] . ' has been moved to ' . $txt['movetopic_auto_board'];

But that's just the default text for moving a topic. It can be manually changed when moving a topic...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

PierreP_whited00r_com

Quote from: margarett on September 03, 2013, 06:49:35 PM
...Anyway,as I suspected, this is really quite simple. All the information is already here, so we just need to display it.

Have a look in Sources/MoveTopic.php, specifically this part here:
...code]
   if (isset($_POST['postRedirect']))...

Thank you very much for taking the time to post this. 8)

I asked the person in charge of modding our forum to try that & will report if it worked for us.

It could take a couple of days because he is very busy with all the other things going on in his life.

Advertisement: