Skip to main content
Topic: How to add the reply-button to the quickbuttons? (Read 2327 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to add the reply-button to the quickbuttons?

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:

Re: How to add the reply-button to the quickbuttons?

Reply #1

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:

Re: How to add the reply-button to the quickbuttons?

Reply #2

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?

Code: [Select]
	// 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>';

Re: How to add the reply-button to the quickbuttons?

Reply #3

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:
Code: [Select]
		call_integration_hook('integrate_display_buttons');

Try adding:
Code: [Select]
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).
Last Edit: April 30, 2016, 02:53:30 pm by emanuele
Bugs creator.
Features destroyer.
Template killer.

Re: How to add the reply-button to the quickbuttons?

Reply #4

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.
~ SimplePortal Support Team ~

Re: How to add the reply-button to the quickbuttons?

Reply #5

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.
Last Edit: May 01, 2016, 03:59:58 am by Ruth

Re: How to add the reply-button to the quickbuttons?

Reply #6

Quote from: Ruth – 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
sorry for my bad english