SMF 2.1. Replace the "Quick edit" button with "Modify".

Started by User2, January 20, 2023, 09:08:56 AM

Previous topic - Next topic

User2

SMF 2.1.3.
How to make the "Modify" button appear instead of the "QUICK EDIT" button. I don't need the "QUICK EDIT" button at all.


Sir Osis of Liver

Yes, he did.  Steve recommended posting in coding.

Shouldn't be too difficult, will have a look soon as I get a chance, if someone else doesn't get to it first.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

Display.php


$output['quickbuttons'] = array(
'quote' => array(
'label' => $txt['quote_action'],
'href' => $scripturl.'?action=post;quote='.$output['id'].';topic='.$context['current_topic'], '.'.$context['start'].';last_msg='.$context['topic_last_message'],
'javascript' => 'onclick="return oQuickReply.quote('.$output['id'].');"',
'icon' => 'quote',
'show' => $context['can_quote']
),
'quote_selected' => array(
'label' => $txt['quote_selected_action'],
'id' => 'quoteSelected_'. $output['id'],
'href' => 'javascript:void(0)',
'custom' => 'style="display:none"',
'icon' => 'quote_selected',
'show' => $context['can_quote']
),
'modify' => array(
'label' => $txt['modify'],
'href' => $scripturl.'?action=post;msg='.$output['id'].';topic='.$context['current_topic'].'.'.$context['start'],
'icon' => 'modify_button',
'show' => $output['can_modify']
),

'more' => array(
'remove_topic' => array(
'label' => $txt['remove_topic'],
'href' => $scripturl.'?action=removetopic2;topic='.$context['current_topic'].'.'.$context['start'].';'.$context['session_var'].'='.$context['session_id'],
'javascript' => 'data-confirm="'.$txt['are_sure_remove_topic'].'"',
'class' => 'you_sure',
'icon' => 'remove_button',
'show' => $context['can_delete'] && ($context['topic_first_message'] == $output['id'])
),


This will replace Quick Edit with Modify, and remove Modify from More.  Backup the file before you try this.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sesquipedalian

That will work. However, I recommend making this change by using the integrate_prepare_display_context hook rather than by editing the Display.php file.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Sir Osis of Liver

That may be a bitfor OP.  The code edit is pretty simple and easy to undo.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

User2

Sir Oasis of Liver, which is the path to the file Display.php?

Kindred

Sources


Dude. Instead of asking for us to spoon feed you, you'll get alot more traction if you at least TRY before asking....
Сл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."

User2

Why would I try to do something? I'm just an SMF user, not an SMF web developer. After discussing these issues, I will no longer do this.

Sir Osis of Liver

/Sources/Display.php

You're just moving 'modify' => array( from 'more' => array( up to $output['quickbuttons'] = array(.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Doug Heffernan

Quote from: Participant on January 21, 2023, 01:14:50 PMWhy would I try to do something?

To achieve what you asked for?

Quote from: Participant on January 21, 2023, 01:14:50 PMI'm just an SMF user, not an SMF web developer.

You don't have to be a developer to do the aformentioned edits.

Quote from: Participant on January 21, 2023, 01:14:50 PMI will no longer do this.

Then don't.

User2


Random Username

This is a fantastic thread. I like suppressing quick reply in favor of the full editor for consistency and the full suite of editor features. I love axing the quick edit button in favor of modify. But, can I have the reply box open by default when viewing a thread so there is not need to hit the reply button? Can I have the attachment and other options drop down open by default?

Thank you!

Kindred

Quote from: Random Username on January 24, 2023, 06:18:40 AMThis is a fantastic thread. I like suppressing quick reply in favor of the full editor for consistency and the full suite of editor features. I love axing the quick edit button in favor of modify. But, can I have the reply box open by default when viewing a thread so there is not need to hit the reply button? Can I have the attachment and other options drop down open by default?

Thank you!


Ummmm.... dude?

Quotecan I have the reply box open by default when viewing a thread so there is not need to hit the reply button

You LITERALLY just asked for what exists in 2.1.x.
Сл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."

Random Username

I hope you're right and I'm confused! But... are you talking about this quick reply box that opened in this thread by default? It doesn't have the add attachment dialogue and thus isn't open by default. You have to hit preview? The other thing is I don't care which one achieves it but I don't like having both. If could have quick reply open with attachment upload box open by default, then wonderful. Then just remove the reply button and replace it with quick reply or just change the names. lol. Am I making any sense? I know different people like different things... and have different needs.

This is what I'm after:

Kindred

that is true -- attachments require the full editor.  However, 99% of the people who are responding to a post DO NOT want to add an attachment - and the attachment system is complicated enough that loading it in a thread would be  poor idea.   So, having the fill editor, with attachments, in the quick reply location is not going to happen.

however, the quick reply in 2.1 contains all the OTHER functionality of the full editor.
Сл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."

Random Username

I understand your position, wanting what's best for the app/team. Excuse me if I don't use the correct terminology. My needs are a little different though perhaps. I don't suppose you might give me a hint? hehe.

Thanks Kindred.

Sir Osis of Liver

#17
Quote from: Random Username on January 24, 2023, 06:18:40 AMCan I have the attachment and other options drop down open by default?

2.0 had a theme setting to enable/disable collapsible additional post options, another good idea that apparently was  removed from 2.1.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Random Username

I see. I still would appreciate any hints anyone can give me on any of it. I've tried a few things but to no avail as of yet, basically trying to replace the call to the quickreply template. Very simplistic, I know.

Sir Osis of Liver

The code posted above will cause all posts and edits to go to the full reply editor.  Diego's mod will allow you to hide quick reply.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Random Username

I must be doing something wrong. Currently no reply opens automatically but the buttons for quick reply are replaced as described. Presently you have to click reply to open up the dialogue and then another click to open the attachment dialogue.

Random Username

Seems like now I saw what I thought was a javascript action to open the attachment window somewhere.... If I could add that to the quick reply javascript section in display.template.php, would that not achieve the goal?

Sir Osis of Liver

OP wanted to remove Quick Reply, the mod does that.  He also wanted to remove Quick Edit and replace it with Modify, the code does that.  I don't believe there's any way to uncollapse "Attachments and other options" in 2.1, would require a code edit.  You can try it here -

Post.template.php


// If the admin has enabled the hiding of the additional options - show a link and image for it.
if (!empty($modSettings['additional_options_collapsable']))
echo '
<div id="post_additional_options_header">
<strong><a href="#" id="postMoreExpandLink"> ', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong>
</div>';

echo '
<div id="post_additional_options">';

// Display the checkboxes for all the standard options - if they are available to the user!


If there is a setting, I can't find it.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Random Username


Kindred

As i already said,  You will not be able to easily put the full editor into the quick reply location.

Сл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."

Random Username

Thank you, Kindred. I'll pay my developer to do it, maybe.

Sesquipedalian

@Random Username, this isn't exactly what you are asking for, but it may be of interest. It was created in response to the same request from a few other users, and those who have used it have been satisfied with it as a solution.
https://custom.simplemachines.org/index.php?mod=4313
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Sir Osis of Liver

Just getting back to this.  To keep attachments and other options uncollapsed -

Post.template.php


/// If the admin has enabled the hiding of the additional options - show a link and image for it.
$modSettings['additional_options_collapsable'] = null;
if (!empty($modSettings['additional_options_collapsable']))
echo '
<div id="post_additional_options_header">
<strong><a href="#" id="postMoreExpandLink"> ', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong>
</div>';

echo '
<div id="post_additional_options">';

// Display the checkboxes for all the standard options - if they are available to the user!



Bit of a hack, but it's simple and works.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Random Username


Random Username

Or maybe it is working. I do not have quick reply showing up. I have the modify button on the quick buttons instead of quick edit and if I hit reply the attachments options are there. I assume this is what I just changed. I'm just greedy. I want the post reply with attachments to show up without having to hit reply. Like quick reply was but with the attachment options.

It comes down to this. I want to encourage posting attachments as much as possible. If it could upload for them, I'd do that. ;)

@Sesquipedalian Thank you. Unfortunately that mod would not install for me.

Sir Osis of Liver

If you want to simplify the ui and encourage members to post attachments, remove quick reply with the mod, replace quick edit with modify, and edit post template to always show attachments uncollapsed.  That's the simplest way to do it, and simplest way for members to use it.  Some members will not even know quick reply exists if they have to scroll down after last post to find it.  You can also remove the other options and shortcuts, which aren't especially useful to most members (I never use them). 
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Random Username


Sir Osis of Liver

They're in Post.template.php -


// Display the checkboxes for all the standard options - if they are available to the user!
echo '
<div id="post_settings" class="smalltext">
<ul class="post_options">
', $context['can_notify'] ? '<li><input type="hidden" name="notify" value="0"><label for="check_notify"><input type="checkbox" name="notify" id="check_notify"' . ($context['notify'] || !empty($options['auto_notify']) || $context['auto_notify'] ? ' checked' : '') . ' value="1"> ' . $txt['notify_replies'] . '</label></li>' : '', '
', $context['can_lock'] ? '<li><input type="hidden" name="already_locked" value="' . $context['already_locked'] . '"><input type="hidden" name="lock" value="0"><label for="check_lock"><input type="checkbox" name="lock" id="check_lock"' . ($context['locked'] ? ' checked' : '') . ' value="1"> ' . $txt['lock_topic'] . '</label></li>' : '', '
<li><label for="check_back"><input type="checkbox" name="goback" id="check_back"' . ($context['back_to_topic'] || !empty($options['return_to_post']) ? ' checked' : '') . ' value="1"> ' . $txt['back_to_topic'] . '</label></li>
', $context['can_sticky'] ? '<li><input type="hidden" name="already_sticky" value="' . $context['already_sticky'] . '"><input type="hidden" name="sticky" value="0"><label for="check_sticky"><input type="checkbox" name="sticky" id="check_sticky"' . ($context['sticky'] ? ' checked' : '') . ' value="1"> ' . $txt['sticky_after_posting'] . '</label></li>' : '', '
<li><label for="check_smileys"><input type="checkbox" name="ns" id="check_smileys"', $context['use_smileys'] ? '' : ' checked', ' value="NS"> ', $txt['dont_use_smileys'], '</label></li>', '
', $context['can_move'] ? '<li><input type="hidden" name="move" value="0"><label for="check_move"><input type="checkbox" name="move" id="check_move" value="1"' . (!empty($context['move']) ? ' checked" ' : '') . '> ' . $txt['move_after_posting'] . '</label></li>' : '', '
', $context['can_announce'] && $context['is_first_post'] ? '<li><label for="check_announce"><input type="checkbox" name="announce_topic" id="check_announce" value="1"' . (!empty($context['announce']) ? ' checked' : '') . '> ' . $txt['announce_topic'] . '</label></li>' : '', '
', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2"' . ($context['show_approval'] === 2 ? ' checked' : '') . '> ' . $txt['approve_this_post'] . '</label></li>' : '', '
</ul>
</div><!-- #post_settings -->';




Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Random Username

Thank you, Sir. Great stuff. Still love to have the reply window open by default if a solution comes to you! ;)

 ;D

Sir Osis of Liver

Which reply window?  Quick reply is open by default, but we're removing that.  You can only get to post editor using reply button.  If you tried to replace quick edit with the full post editor, I think some people would have problems finding it.  You have to bear in mind that a page will display differently in different browsers, on different monitors with different screen resolutions, and on mobile devices.  If you do too much cutting and patching the result may look fine to you, but may be unuseable to others.  Can also cause problems with future updates.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Random Username

I'd be fine with quick reply if it was open with attachment options by default.

Kindred

but that's the thing --  the attachment code is "heavy" - which is why it's only loaded in the main post/reply screen.
Сл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."

Random Username

Kindred, I understand but my needs are different. I will have enough server capacity to handle it. And this is minor compared to other heavy stuff I'm doing.

Kindred

Your needs are mostly irrelevant to the situation - It's not a SERVER heavy thing -- it's a CLIENT heavy thing.

believe me when I say: There is a reason why the attachments is not part of the quick reply box.
Сл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."

Sesquipedalian

Quote from: Random Username on January 25, 2023, 02:16:20 PM@Sesquipedalian Thank you. Unfortunately that mod would not install for me.

That's very strange to hear. The mod uses only integration hooks, so the only way it could fail to install would be if you have messed up file permissions. Check those and try again.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Advertisement: