Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: User2 on January 20, 2023, 09:08:56 AM

Title: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: User2 on January 20, 2023, 09:08:56 AM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: mickjav on January 20, 2023, 10:14:36 AM
Haven't You already asked this Question???
Here: https://www.simplemachines.org/community/index.php?topic=584784.0
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 20, 2023, 12:19:19 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 20, 2023, 12:45:00 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sesquipedalian on January 20, 2023, 01:16:12 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 20, 2023, 08:22:41 PM
That may be a bit(https://thekrashsite.com/pics/overhead.gif)for OP.  The code edit is pretty simple and easy to undo.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: User2 on January 21, 2023, 01:08:24 PM
Sir Oasis of Liver, which is the path to the file Display.php?
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Kindred on January 21, 2023, 01:09:59 PM
Sources


Dude. Instead of asking for us to spoon feed you, you'll get alot more traction if you at least TRY before asking....
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: User2 on January 21, 2023, 01:14:50 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 21, 2023, 03:22:14 PM
/Sources/Display.php

You're just moving 'modify' => array( from 'more' => array( up to $output['quickbuttons'] = array(.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Doug Heffernan on January 21, 2023, 03:26:38 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: User2 on January 23, 2023, 09:07:35 AM
Sir Osis of Liver, thank you.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 24, 2023, 06:18:40 AM
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!
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Kindred on January 24, 2023, 10:09:51 AM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 24, 2023, 10:26:17 AM
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:
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Kindred on January 24, 2023, 11:52:22 AM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 24, 2023, 12:32:32 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 24, 2023, 04:22:01 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 24, 2023, 04:55:07 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 24, 2023, 04:58:27 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 24, 2023, 05:22:21 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 24, 2023, 05:27:11 PM
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?
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 24, 2023, 05:38:08 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 24, 2023, 05:54:53 PM
Thank you, Sir. I will investigate.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Kindred on January 24, 2023, 11:59:33 PM
As i already said,  You will not be able to easily put the full editor into the quick reply location.

Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 25, 2023, 08:40:35 AM
Thank you, Kindred. I'll pay my developer to do it, maybe.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sesquipedalian on January 25, 2023, 11:29:31 AM
@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
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 25, 2023, 12:31:54 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 25, 2023, 01:53:15 PM
Hi, unfortunately this isn't working for me.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 25, 2023, 02:16:20 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 25, 2023, 08:05:15 PM
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). 
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 25, 2023, 08:15:30 PM
How do you remove the other options? ;)
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 25, 2023, 08:24:39 PM
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 -->';




Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 25, 2023, 08:58:37 PM
Thank you, Sir. Great stuff. Still love to have the reply window open by default if a solution comes to you! ;)

 ;D
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sir Osis of Liver on January 25, 2023, 09:10:51 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 25, 2023, 09:56:31 PM
I'd be fine with quick reply if it was open with attachment options by default.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Kindred on January 26, 2023, 08:57:55 AM
but that's the thing --  the attachment code is "heavy" - which is why it's only loaded in the main post/reply screen.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Random Username on January 26, 2023, 09:24:15 AM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Kindred on January 26, 2023, 03:48:31 PM
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.
Title: Re: SMF 2.1. Replace the "Quick edit" button with "Modify".
Post by: Sesquipedalian on January 26, 2023, 10:33:16 PM
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.