Hello!
People often abuse the quote-button, if they want to reply in a topic, because they are too lazy to scroll up or down to the normal reply-button. ;) This behavior is getting much better, if there is a reply-button in each post.
There is a quickbutton in the core-posts, wich allows you to reply:
I would like to add such a reply-quickbutton to the quickbuttons in the posts of a topic.
How can I do this?
It should look like this, the reply-button should be the first one there:
Maybe it should be changed somewhere here in Display.template.php? O:-)
Can I use (copy) the part with
if ($context['can_quote'] to add a quickbutton for reply?
// Can the user quick modify the contents of this post? Show the quick (inline) modify button.
if ($message['can_modify'])
echo '
<li class="listlevel1 quick_edit" id="modify_button_', $message['id'], '" style="display: none"><a class="linklevel1 quick_edit" onclick="oQuickModify.modifyMsg(\'', $message['id'], '\')">', $txt['quick_edit'], '</a></li>';
// Can they reply? Have they turned on quick reply?
if ($context['can_quote'] && !empty($options['display_quick_reply']))
echo '
<li class="listlevel1">
<a href="', $scripturl, '?action=post;quote=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';last_msg=', $context['topic_last_message'], '" onclick="return oQuickReply.quote(', $message['id'], ');" class="linklevel1 quote_button">', $txt['quote'], '</a>
</li>';
Sorry, but I wasn't able to have a look at the code until now (actually now there is a storm going on, so the power could drop and I wouldn't be able to answer anyway ::)).
This would require a little addon to set the hook appropriately, though, let's do it quick&dirty for this time.
In Display.controller.php, around this line:
call_integration_hook('integrate_display_buttons');
Try adding:
if ($context['can_reply'])
{
$context['additional_quick_buttons']['msg_reply'] = array(
'href' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'],
'text' => $txt['reply'],
);
if (!empty($options['display_quick_reply']))
{
addInlineJavascript('
// Smooth scroll to top.
$(".msg_reply").on("click", function(e) {
e.preventDefault();
// Move the view to the quick reply box.
if (navigator.appName === \'Microsoft Internet Explorer\')
window.location.hash = \'quickreply\';
else
window.location.hash = \'#\' + \'quickreply\';
document.forms.postmodify.message.focus();
});', true);
}
}
Not really elegant, but should do the trick.
The only condition it is likely to fail is when the quick reply is collapsed (and now that I think about it, with the WYSIWYG it will not place the cursor properly, it requires some other trick).
Why do you want to make your life harder? Just make it go into a new page in advanced mode, there is a mod that does exactly what I said for smf.
Thank you very much, Emanuele. This is completly different to the way I thought it could be done... O:-)
At the moment, I can't try your code...but I will.
I need a third forum, a place to play and for testing things like this.
I suggest you to try in localhost, download and install WAMP or XAMPP then install a copy of elkarte, in this way you can make all the tests you want without breaking your online forum