News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Reply To

Started by Ryan F, June 03, 2005, 02:50:04 PM

Previous topic - Next topic

Ryan F

Link to Mod

Adds a new button to the message index to allow users to reply to a specific post. Their reply is then marked with the display name of the user they replied to.

DangerGirl

#1
Oh man, I've needed this Mod.  Thanks!  I did receive an error though, when I went to post:

Template Parse Error!
There was a problem loading the /Themes/default/Post.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.


This is the code with the error:

// Assuming this isn't a new topic pass across the number of replies when the topic was created.
if (isset($context['num_replies']))
echo '
<input type="hidden" name="num_replies" value="', $context['num_replies'], '" />
<input type="hidden" name="replyto" value="', $replyto,'" />';';


It has an extra '; in it at the very end.  So do this:

Open up Post.template.php in your Default theme folder.

Find:
<input type="hidden" name="replyto" value="', $replyto,'" />';';

Replace:
<input type="hidden" name="replyto" value="', $replyto,'" />';

It did the trick for me.

esserdk

you trick dose work for me too. Thanks for the tip! ;D

Ryan F

Quote from: DangerGirl on June 05, 2005, 03:49:56 AM
...It has an extra '; in it at the very end.  So do this:...
Whoops, the mod was being inserted in front of an existing '; - I've uploaded a new version that should install just fine. Thanks for catching that mistake  :D

AtariKid

#4
This was very much needed.  Many times, people forget to quote who/what they are replying to.  Thank you !!

Hmm ... Step 5 - Execute Modification ./Themes/default/Display.template.php - Failure

Any suggestions? 

Edited ... I went ahead of selected proceed ... I can always go back and delete it and reinstall.

I've tested it and my reply was not marked with the display name of the user I replied to.  It does let me know which post # I am replying to, but it doesn't display a thing.  Possibly, there is an error in Display.template.php ... either that or it didn't upload properly.
Rawk on dude!
SMF 1.1 RC1 | MKP 1.1 Rc1

Ryan F

Quote from: AtariKid on June 16, 2005, 03:51:36 PM
...Hmm ... Step 5 - Execute Modification ./Themes/default/Display.template.php - Failure

Any suggestions? 
...
Do you have any other mods installed? If so, could you list them? Another mod may be conflicting with the changes this one makes.


whoisthisguy?

Sorry - this is probably a really n00b question - but I only installed a SMF for the 1st time yesterday...

I've installed this package and i'm guessing its only in the default theme. Can you please tell me how do I get it to work on the theme i'm using on my forum?

Thanks

Ryan F

Quote from: whoisthisguy? on July 04, 2005, 05:08:55 PM
Sorry - this is probably a really n00b question - but I only installed a SMF for the 1st time yesterday...

I've installed this package and i'm guessing its only in the default theme. Can you please tell me how do I get it to work on the theme i'm using on my forum?

Thanks
What version of SMF and my mod are you using?

Itch™

Can't install it: "Hacking Attempt" I downloaded the right version for 1.1 Beta 3 Public. What can be wrong?

whoisthisguy?

Quote from: Ryan F on July 05, 2005, 06:56:59 PM

What version of SMF and my mod are you using?


SMF 1.0.5

Reply To 1.0.1 (which I downloaded from your post on July 2nd.)

The button appears on the SMF Default theme but not the theme the board is actually using. I reckon it's probably just a case of amending templates, but I'm not sure and a bit of guidance would be MUCH appreciated...

Thanks for replying so fast =)

wgm

#11
Quote from: YahMan on July 06, 2005, 05:38:32 AM
Can't install it: "Hacking Attempt" I downloaded the right version for 1.1 Beta 3 Public. What can be wrong?

The same thing here.

Only mod installed is googlebot and spiders, but was getting that message before this.

Ryan F

Quote from: YahMan on July 06, 2005, 05:38:32 AM
Can't install it: "Hacking Attempt" I downloaded the right version for 1.1 Beta 3 Public. What can be wrong?
I just updated the version for 1.1. It should work now, but I've got no way to test it without deleting my forum's reply data :P

Ryan F

Quote from: whoisthisguy? on July 06, 2005, 01:52:05 PM
...The button appears on the SMF Default theme but not the theme the board is actually using. I reckon it's probably just a case of amending templates, but I'm not sure and a bit of guidance would be MUCH appreciated...
Alright here goes...
There are two files you'll need to edit: Display.template.php and Post.template.php.
You can find them in /Themes/yourtheme
If the theme doesn't have either of those files, don't worry about it.

Open Display.template.php and and at the very bottom of the file (after the last  } but before the ?> ) place this code:

function is_reply()
{
global $message, $db_prefix, $REPLY_ID, $replyname;

$id_mess = $message['id'];

$is_reply = db_query("
SELECT replyto
FROM {$db_prefix}messages
WHERE ID_MSG = $id_mess",__FILE__, __LINE__);
list ($REPLY_ID) = mysql_fetch_row($is_reply);
mysql_free_result($is_reply);

if($REPLY_ID != 0){
$row = db_query("
SELECT reply.realName
FROM {$db_prefix}members AS reply, {$db_prefix}messages AS find
WHERE find.ID_MSG = $REPLY_ID
AND reply.ID_MEMBER = find.ID_MEMBER
LIMIT 1",__FILE__, __LINE__);
list ($replyname) = mysql_fetch_row($row);
mysql_free_result($row);}

}


Next, go back to the top of the file and look for this line:

global $context, $settings, $options, $txt, $scripturl, $modSettings;


and then place this directly beneath it:

global $message, $REPLY_ID, $topic, $replyname;


Now find this chunk:

// If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
echo '
<div class="smalltext">« <b>', !empty($message['counter']) ? $txt[146] . ' #' . $message['counter'] : '', ' ', $txt[30], ':</b> ', $message['time'], ' »</div></td>
<td align="right" valign="bottom" height="20" nowrap="nowrap" style="font-size: smaller;">';

// Can they reply?  Have they turned on quick reply?


and completely paste over it with this one:

// If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
is_reply();
echo '
<div class="smalltext">« <b>', !empty($message['counter']) ? $txt[146] . ' #' . $message['counter'] : '', ' ', $txt[30], ':</b> ', $message['time'], ' » ';
if ($REPLY_ID != 0)
echo'
<br/>« Reply to: <a href="', $scripturl, '?topic=', $topic, '.msg', $REPLY_ID, '#msg', $REPLY_ID, '">', $replyname, '</a>»</div></td>
<td align="right" valign="bottom" height="20" nowrap="nowrap" style="font-size: smaller;">';
else
echo '
<td align="right" valign="bottom" height="20" nowrap="nowrap" style="font-size: smaller;">';
// Can they reply?  Have they turned on quick reply?


Find this chunk:

// So... quick reply is off, but they *can* reply?
elseif ($context['can_reply'])
echo '
<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'], ';sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/quote.gif" alt="' . $txt[145] . '" border="0" />' : $txt[145]), '</a>';


Paste this over it:

// So... quick reply is off, but they *can* reply?
elseif ($context['can_reply'])
echo '
<a href="', $scripturl, '?action=post;topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'],';replyto=', $message['id'],';sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/postrep.gif" alt="Post Reply" border="0" />' : 'Post Reply'), '</a>
<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';num_replies=', $context['num_replies'], ';replyto=', $message['id'],';sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/quote.gif" alt="' . $txt[145] . '" border="0" />' : $txt[145]), '</a>';


Alright, now move on to Post.template.php and find this:

global $context, $settings, $options, $txt, $scripturl, $modSettings, $months;


and place this directly underneath:

global $replyto;


After that, look for this little chunk:

</tr>
<tr>
<td class="windowbg">', isset($context['current_topic']) ? '
<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '', '
<table border="0" cellpadding="3" width="100%">';


And place this underneath it:

if ($replyto > 0)
echo '
You are replying to ', $replyto,'
<table border="0" cellpadding="3" width="100%">';


Then find this line:

<input type="hidden" name="num_replies" value="', $context['num_replies'], '" />


And place this underneath it:

<input type="hidden" name="replyto" value="', $replyto,'" />


And finally, unzip the mod package and upload postrep.gif to /Themes/yourtheme/images/english  :)

whoisthisguy?

Wow.... thanks for the guide! I'll give it a go later today.

Just so i know, am I just being completely noobish or is this a proper question?  ???

whoisthisguy?

#15
Yeh, worked! Aceness. This mod is great. Made a new button for "reply to" to fit in with my theme (fits with the YaBB theme too cos i use the buttons from that). Here it is incase it's of any use to anyone.



Thanks again :)

wgm

Quote from: Ryan F on July 08, 2005, 12:52:26 AM
Quote from: YahMan on July 06, 2005, 05:38:32 AM
Can't install it: "Hacking Attempt" I downloaded the right version for 1.1 Beta 3 Public. What can be wrong?
I just updated the version for 1.1. It should work now, but I've got no way to test it without deleting my forum's reply data :P

Thank you, its quite a nice addition, it does work.

izpitera

Great mod! Respect!!!
What you think about compatible with base format  in next SMF version?

Itch™

It installs without a problem, but where's the button??

YM

Ryan F

Quote from: YahMan on July 14, 2005, 02:45:33 PM
It installs without a problem, but where's the button??

YM
On every post to the left of the Quote button. It's labeled 'Post Reply'.

Advertisement: