Remove Subject from Replies

Also remove "post icons" option from "Post Reply" editor. - Remove Subject from Replies

Also remove "post icons" option from "Post Reply" editor.

by ctrstudio » Thu Feb 27, 2020 1:07 am

I noticed that after this extension removes the subject from replies, it still leaves the "post icon" selections above the editor. I can't see anywhere in which the post icon appears for a reply after the subject has been removed.

It seems like that might be a little confusing for some members if they try selecting a "post icon" on a reply and don't see it display anywhere. If they later post a new topic they might think there's no use for selecting a topic icon either. The topic icon for the original post is still desirable, though, as it does get displayed for the Topic subject itself.

It looks like this would be a lot easier if there were some "posting_editor_topic_icons_before" and "posting_editor_topic_icons_after" hook locations surrounding the "topic icons" section in "posting-editor.html". Then it would be easy to just enclose that section in a hidden div like you did with the subject. Unfortunately, those hooks don't exist and the first existing hook location is "posting_editor_subject_before" which doesn't happen until after the topic icons are already in place. So, I don't see any way of directly using event hooks to hide the "post icons" section in the post reply editor.

Is there another way to remove the "post icon" selectors from displaying above the editor for reply posts, but still leave the "topic icon" selectors to display when editing the original topic? (or is the post icon still displayed somewhere that I just haven't noticed yet?)
Last edited by ctrstudio on Wed Mar 04, 2020 10:08 pm
User avatar
ctrstudio
Registered User
Posts: 56
Joined: Wed Jan 01, 2020 4:32 am
Name: C. T. Ransbury
Contact:

Re: Also remove "post icons" option from "Post Reply" editor

by ctrstudio » Fri Feb 28, 2020 8:38 am

Hi Senky, I had some time to look closer into how the extension works today. I was able to come up with the following solution for what I asked about, but I'd still be interested in knowing if you have a better way. :)

If you're interested, this is what I did to hide the "post icons" options in the reply editor while leaving the "topic icons" options available on the topic editor page. The simplest way I came up with to do this is by adding an additional css file and editing "overall_header_head_append.html" to include the css file when necessary.

I added the last 3 lines in this event file:
...removesubjectfromreplies/styles/prosilver/template/event/overall_header_head_append.html

Code: Select all

<!-- IF S_VIEWTOPIC -->
    <!-- INCLUDECSS @senky_removesubjectfromreplies/removesubjectfromreplies.css -->
<!-- ENDIF -->

<!-- IF not S_PRIVMSGS and not S_NEW_MESSAGE -->
    <!-- INCLUDECSS @senky_removesubjectfromreplies/removeposticonsfromeditor.css -->
<!-- ENDIF -->
and created this new css file:
...removesubjectfromreplies/styles/prosilver/theme/removeposticonsfromeditor.css

Code: Select all

label[for="icon"] {
    display: none;
}

input[name="icon"] {
    display: none;
}

dd img[src*="icons"] {
    display: none;
}
This accomplishes exactly what I was asking for in my topic post. The only thing I don't like is the identifiers are fairly generic, especially how it has to use a wildcard for the img src identifier. That's due to how phpBB has the markup code in the "topic icons" section. There just aren't any unique identifiers provided for any tags in that section. It's probably unlikely to cause any conflicts since the [src*="icons"] only applies for the <img> tag when its inside a <dd> tag.

You could add more conditions in the event file if you wanted to exclude the new css from any other pages, ie. {IF not S_VIEWFORUM and not S_VIEWTOPIC and not S_PRIVMSGS and not S_NEW_MESSAGE}, but the css doesn't seem to be a problem on those pages and would still be included on some other pages anyway. (I couldn't find a template variable that flags true for just the post editor page).

My forum has 25 other extensions enabled and there isn't any conflict with any of them caused by using those particular css identifiers to control hiding/showing the post/topic icons (label, radio buttons, and icons) in the reply/topic editor. So, considering how posting_editor.html and your extension's code is set up now, this might be as good as it gets.

Now the Post A New Topic editor still has Topic Icon options and Subject box:
Image
and the Post A Reply editor has no option for Post Icons when Subject is removed:
Image

I hope any of that info might be of some help. :) Controlling it like that works fine on my forum, so I'll be leaving it like that for now, unless there's another solution that you think would be preferable.

Thanks for the extension,
Lee (ctrstudio)


------- Note: -------
The only other way I can think of to accomplish this would be playing around with S_SHOW_TOPIC_ICONS flag in the listener to turn off the topic icons section in the posting editor when desired.

Maybe some kind of logic like this would work:
  1. Get forum setting for S_SHOW_TOPIC_ICONS from db.
  2. if S_SHOW_TOPIC_ICONS is true and S_NEW_MESSAGE is false,
    then set S_SHOW_TOPIC_ICONS to false before loading posting_editor.html
That might be more bullet proof in regards to any potential conflicts with other extensions.

Of course, the best solution would be if phpBB developers were to surround the topic icons section in "posting_editor.html" with some event locations for "posting_editor_topic_icons_before" and "posting_editor_topic_icons_after". That could possibly be useful for other extension authors in the future as well. Even if you did request it though, and it was approved, I imagine it might be a long wait for the actual implementation. So, that wouldn't help for any immediate needs. :)
User avatar
ctrstudio
Registered User
Posts: 56
Joined: Wed Jan 01, 2020 4:32 am
Name: C. T. Ransbury
Contact:

Re: Also remove "post icons" option from "Post Reply" editor

by ctrstudio » Thu Mar 12, 2020 11:07 pm

Hi Jakub, I found another potential use for some posting_editor_topic_icons-xxxxx events that would be of help for another extension idea I'm interested in as well, so I looked into how to do a PR for the events myself. It turns out that I don't really have the time right now to deal with the learning curve involved in how to submit a PR. lol. Fortunately, someone else offered their help to just submit it for me.

If the PR does get approved and merged, then using posting_editor_topic_icons-before and posting_editor_topic_icons-after events could be used to place a hidden div around the Topic Icons section, the same as is currently done by your extension for hiding the Subject box in the Reply Editor.

(There's some posting_editor_topic_icons-prepend and posting_editor_topic_icons-append events that were also submitted, but those are for the other unrelated extension idea that I'm working on.)

So, if you might be interested in the idea of using those events for hiding the Post Icons when you're hiding the Subject box in the Reply editor, then here's the ticket: https://tracker.phpbb.com/browse/PHPBB3-16400 and the PR: https://github.com/phpbb/phpbb/pull/5899 .

Doing it with events like this would be a much better solution for hiding the Post Icon inputs than the css solution described in my previous reply.
User avatar
ctrstudio
Registered User
Posts: 56
Joined: Wed Jan 01, 2020 4:32 am
Name: C. T. Ransbury
Contact:

Re: Also remove "post icons" option from "Post Reply" editor

by Senky » Fri Aug 14, 2020 1:57 pm

Hi ctrstudio,
thanks for the report and analysis. It can be, in fact, solved very easily by setting S_SHOW_TOPIC_ICONS template variable to false. A new version is already awaiting approval.
‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎📝‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎ ‎‏‎‏‏‎ ‎ ‎ ‎🔔 ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎‏‏‎ ‎ ‎‎ ‎ ‎ ‎ ‎ ‎ ‎‏‏‎ ‎‏‏‎ ‎ ‎🛠
Forms Extension | Browser & Mobile Notifications Extension | Mixed Content Fixer Extension
Senky
Extension Customisations
Extension Customisations
Posts: 2290
Joined: Thu Apr 30, 2009 8:49 pm
Name: Jakub
Contact: