An extension to show a link for more post icons

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Ideas Centre
Post Reply
User avatar
John connor
Registered User
Posts: 2530
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

An extension to show a link for more post icons

Post by John connor »

By default in phpBB, when you omit certain post icons to show on the posting page, there is no link provided to allow you to chose other topic icons other than the ones set to show up on the posting page. So I'm thinking and extension can be created to show a link for more topic icons like there is for smiles to show more smiles that don't show up on the posting page.

User avatar
ctrstudio
Registered User
Posts: 42
Joined: Wed Jan 01, 2020 4:32 am
Name: C. T. Ransbury

Re: An extension to show a link for more post icons

Post by ctrstudio »

John connor wrote:
Fri Aug 09, 2019 1:32 pm
...So I'm thinking and extension can be created to show a link for more topic icons like there is for smiles to show more smiles that don't show up on the posting page.
The problem with making this extension is that this is the topic icons section in the prosilver template file posting_editor.html

Code: Select all

	<!-- IF S_SHOW_TOPIC_ICONS or S_SHOW_PM_ICONS -->
	<dl>
		<dt><label for="icon">{L_ICON}{L_COLON}</label></dt>
		<dd>
			<label for="icon"><input type="radio" name="icon" id="icon" value="0" checked="checked" tabindex="1" /> <!-- IF S_SHOW_TOPIC_ICONS -->{L_NO_TOPIC_ICON}<!-- ELSE -->{L_NO_PM_ICON}<!-- ENDIF --></label>
			<!-- BEGIN topic_icon --><label for="icon-{topic_icon.ICON_ID}"><input type="radio" name="icon" id="icon-{topic_icon.ICON_ID}" value="{topic_icon.ICON_ID}" {topic_icon.S_ICON_CHECKED} tabindex="1" /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="{topic_icon.ICON_ALT}" title="{topic_icon.ICON_ALT}" /></label> <!-- END topic_icon -->
		</dd>
	</dl>
	<!-- ENDIF -->
As you can see, there are no hook locations to insert any custom code.
If there were some hook locations like this:

Code: Select all

<!-- EVENT posting_editor_topic_icons_before -->
	<!-- IF S_SHOW_TOPIC_ICONS or S_SHOW_PM_ICONS -->
	<dl>
		<dt><label for="icon">{L_ICON}{L_COLON}</label></dt>
		<dd>
<!-- EVENT posting_editor_topic_icons_prepend -->
			<label for="icon"><input type="radio" name="icon" id="icon" value="0" checked="checked" tabindex="1" /> <!-- IF S_SHOW_TOPIC_ICONS -->{L_NO_TOPIC_ICON}<!-- ELSE -->{L_NO_PM_ICON}<!-- ENDIF --></label>
			<!-- BEGIN topic_icon --><label for="icon-{topic_icon.ICON_ID}"><input type="radio" name="icon" id="icon-{topic_icon.ICON_ID}" value="{topic_icon.ICON_ID}" {topic_icon.S_ICON_CHECKED} tabindex="1" /><img src="{topic_icon.ICON_IMG}" width="{topic_icon.ICON_WIDTH}" height="{topic_icon.ICON_HEIGHT}" alt="{topic_icon.ICON_ALT}" title="{topic_icon.ICON_ALT}" /></label> <!-- END topic_icon -->
<!-- EVENT posting_editor_topic_icons_append -->
		</dd>
	</dl>
	<!-- ENDIF -->
<!-- EVENT posting_editor_topic_icons_after -->
Then it would be easy to use posting_editor_topic_icons_before.html and posting_editor_topic_icons_after.html to replace the post icons section completely. Or you could use posting_editor_topic_icons_prepend.html or posting_editor_topic_icons_append.html to just insert a button selector with a link to such "additional post icons" like what you are asking for.

Without those (or similar) hook locations in an official phpBB version, you would need to modify the core prosilver template files to include the feature you want directly in posting_editor.html, (or add some hook locations and then write your extension to do what you want by using them). You could also modify or create a new style that would either include the features instead (or include a hook location for an extension). Any of those solutions would involve modifications be made on an individual board, (or if done by creating a new style instead of an extension, then it would only work for that particular style).

The other way to accomplish it might be to use javascript to change the html in the topic icons section after its served to the browser, but that seems like it might be a lot more susceptible to compatibility issues.
Last edited by ctrstudio on Wed Mar 11, 2020 2:58 am, edited 2 times in total.

User avatar
david63
Registered User
Posts: 17775
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: An extension to show a link for more post icons

Post by david63 »

ctrstudio wrote:
Tue Mar 10, 2020 8:03 am
As you can see, there are no hook locations to insert any custom code.
You could always create a PR to add those events
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
ctrstudio
Registered User
Posts: 42
Joined: Wed Jan 01, 2020 4:32 am
Name: C. T. Ransbury

Re: An extension to show a link for more post icons

Post by ctrstudio »

david63 wrote:
Tue Mar 10, 2020 10:56 am
You could always create a PR to add those events
Thanks for the suggestion David. :) I'm still new to phpBB and I haven't done anything like that before. I'm not sure when I'll have the time, but (just in case) I searched for how to submit a PR and found this tutorial, viewtopic.php?f=461&t=2290536.
If I read through to the last reply, is the info in that topic still accurate? ie. Can I pretty much just follow the steps in that thread?

If it is, then I still have a few other questions,
  1. If all I need is some hook locations, is adding the <!-- EVENT template_file_location --> to the particular template_file.html all that's needed, or does the event need to be registered in some other core file as well?
  2. Aside from the wiki, are there any other topics that I should look at and/or ask questions regarding pull requests and adding event hook locations?
  3. Once submitting a PR for adding such things, (if I follow the steps correctly and it does get approved), how long does it typically take for such changes to be included in the official phpBB version download link?

User avatar
david63
Registered User
Posts: 17775
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: An extension to show a link for more post icons

Post by david63 »

ctrstudio wrote:
Tue Mar 10, 2020 12:18 pm
is the info in that topic still accurate? ie. Can I pretty much just follow the steps in that thread?
I haven't read that topic recently but I am not aware of any changes.
ctrstudio wrote:
Tue Mar 10, 2020 12:18 pm
or does the event need to be registered in some other core file as well?
No nothing else needs to be done at template level although you may need to add an event (they are not called hooks in phpBB) in a php file to be able to send the data to the template.
ctrstudio wrote:
Tue Mar 10, 2020 12:18 pm
Aside from the wiki, are there any other topics that I should look at and/or ask questions regarding pull requests and adding event hook locations?
You may find some more information in the Extension Writers forum
ctrstudio wrote:
Tue Mar 10, 2020 12:18 pm
typically take for such changes to be included in the official phpBB version download link?
Depending on timing it would be in the next version release, but there is not time-frame for these - it could be a week or it could be several months
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
ctrstudio
Registered User
Posts: 42
Joined: Wed Jan 01, 2020 4:32 am
Name: C. T. Ransbury

Re: An extension to show a link for more post icons

Post by ctrstudio »

david63 wrote:
Tue Mar 10, 2020 12:55 pm
No nothing else needs to be done at template level
OK Cool. I just tried adding the event locations and see that adding them is the only core change needed for them to work.
david63 wrote:
Tue Mar 10, 2020 12:55 pm
although you may need to add an event (they are not called hooks in phpBB) in a php file to be able to send the data to the template.
Since the first test of just adding the event locations worked, I assume that you're referring to things needed in an extension; I already understand what's involved for that. Right now I'm only concerned with the specifics about submitting a PR for adding the event locations to the core files.
david63 wrote:
Tue Mar 10, 2020 12:55 pm
Depending on timing it would be in the next version release, but there is not time-frame for these - it could be a week or it could be several months
That's what I expected. I'll go ahead and work on submitting a PR when I get some time, but it's not necessarily high on my priority list. It might be a few weeks or more (or tomorrow, lol) depending on what else I'm doing,

User avatar
ctrstudio
Registered User
Posts: 42
Joined: Wed Jan 01, 2020 4:32 am
Name: C. T. Ransbury

Re: An extension to show a link for more post icons

Post by ctrstudio »

John connor wrote:
Fri Aug 09, 2019 1:32 pm
...So I'm thinking and extension can be created to show a link for more topic icons like there is for smiles to show more smiles that don't show up on the posting page.
Well, I looked into what david63 suggested about submitting a PR for the event locations I mentioned would be necessary for an extension to accomplish what you're asking about. (Thanks David.)

Fortunately, in the process of figuring out how to do that, someone was kind enough to offer submitting the PR for me. :)

So, I'm following the ticket now, and if it gets approved and merged then I'll see if I can come up with an extension to do what you're requesting. If I'm able to do it then I'll let you know when its ready for testing.

User avatar
John connor
Registered User
Posts: 2530
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Name: Aaron
Contact:

Re: An extension to show a link for more post icons

Post by John connor »

Thanks! I'm using 3.2.9 right now and am waiting for extensions that I'm using now to be updated for the great 3.3.x migration. I'll most likely wait till 3.2.10 and hope all extension are updated by then without having me to mess with extension files and what not. I'm not a coder so I have no idea how to modify a yaml or JS file, etc to get the extension to work in 3.3.x and if I do, I'm sure that's just a patch so to speak.

Post Reply

Return to “Extension Requests”