[3.3][BETA] Topic Prefix Tags (helper ext)

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Anti-Spam Guide
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

[3.3][BETA] Topic Prefix Tags (helper ext)

Post by martti »

Extension Name: Topic Prefix Tags (helper ext)
Author: martti
Extension Description: This phpBB helper extension provides a PHP event for use by other extensions to set topic title prefix tags.
Extension Version: 0.4.0
Requirements:
  • phpBB 3.3+
  • PHP 7.1+
(For phpBB 3.2 use version 0.3.0)
Extension Download: https://github.com/marttiphpbb/phpbb-ex ... master.zip The files are to be put in ext/marttiphpbb/topicprefixtags
Github repository: https://github.com/marttiphpbb/phpbb-ex ... prefixtags
Languages: no language files included
Templates: prosilver
Screenshots:

These are the different locations the prefix will show up when calling the PHP event provided by this extension. The example is here just showing the id of the topic (not useful, but it is just an example) How to do this is described in the next post below in "For extension Developers: How to use in your extension".

Viewforum:

Image

Viewtopic:

Image

MCP viewforum

Image

MCP viewtopic

Image

Search topics

Image
Last edited by martti on Thu Jan 09, 2020 3:54 pm, edited 8 times in total.
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by martti »

For extension Developers: How to use in your extension

The PHP event from this extension to set topic prefix tags, looks like this:

Code: Select all

		/**
		 * Event to set topic prefix tags 
		 *
		 * @event 
		 * @var	int 	topic_id			changing won't be fed back to calling event
		 * @var	array	topic_data			changing won't be fed back to calling event
		 * @var string  origin_event_name	the name of the original event
		 * @var array	tags				push here your tags 
		 *
		 */
		$vars = ['topic_id', 'topic_data', 'origin_event_name', 'tags'];
		$result = $this->dispatcher->trigger_event('marttiphpbb.topicprefixtags', compact($vars));
The sister extension, Topic Suffix Tags (helper ext), triggers a PHP event that works entirely the same way. You could add listeners for both extensions in your extension to provide your users (admins) flexibility so they can choose whether they want your data be displayed as a prefix or a suffix.

The example in the screenshots, just showing the topic id was implemented like this in the listener:

Code: Select all

	static public function getSubscribedEvents()
{
		return [
			'marttiphpbb.topicprefixtags'	=> 
				'marttiphpbb_topicprefixtags',
		];
	}

	public function marttiphpbb_topicprefixtags($event)
	{
		$tags = $event['tags'];
		$topic_id = $event['topic_id'];
		$tags[] = '[*' . $topic_id . '*]';
		$event['tags'] = $tags;
	}
The values pushed to the $tags array can be:
  1. a string, which will be rendered "raw", so you can include html tags if you like.
  2. an array itself, with keys include and var
In case of b:

include is a string of a template file to be included from your extension, so prefix it with @vendor_myextension/
var can be both a string or an array for providing variables to the included template. (var is the only variable available)

Example of a template:

Code: Select all

[ <a href="{{- var.url -}}"></a><i class="fa fa-pencil"></i> {{ lang('LANG_KEY', var.lang) -}}</a> ]
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by martti »

Version 0.2.0: the PHP event got renamed from
marttiphpbb.topicprefixtags.set_tags
to
marttiphpbb.topicprefixtags
(the documentation above has been updated)
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 3726
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay
Contact:

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by Kailey »

Any chance the viewforum event can be changed so the prefix is AFTER the new topic indicator? Currently displays like this:

prefix.png
prefix.png (13.45 KiB) Viewed 5295 times
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules

If you have any questions about the rules/customs of this website, feel free to send me a PM.
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by martti »

kinerity wrote: Sun Jul 29, 2018 5:03 am Any chance the viewforum event can be changed so the prefix is AFTER the new topic indicator?
Yes, that is not so nice. I have updated the extension (version 0.2.1) now and it show like this:

Image

I had to resort to some Javascript, because there is no template event for it (yet).

(The content of the tag is from a Calendar extension I'm working on. I'll post about that one later.)
elawrenc
Registered User
Posts: 140
Joined: Thu Jul 21, 2011 2:41 pm

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by elawrenc »

Is it linkable? So that when you click it, you can see all messages with same Prefix Tag?

Ex:

[July 31, 2018] This is Message 1
[July 31, 2018] This is Message 2
[July 31, 2018] This is Message 198
[July 31, 2018] Mars Is Large Today
[July 31, 2018] This Is A Really Cool Extension
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by martti »

elawrenc wrote: Fri Aug 03, 2018 5:56 am Is it linkable? So that when you click it, you can see all messages with same Prefix Tag?

Ex:

[July 31, 2018] This is Message 1
[July 31, 2018] This is Message 2
[July 31, 2018] This is Message 198
[July 31, 2018] Mars Is Large Today
[July 31, 2018] This Is A Really Cool Extension
It is up to the consuming extension to define the tag and if it contains a link.
In the case of the calendar I'm working on the date tag will link to the corresponding period on the calendar page.
manigopal
Registered User
Posts: 163
Joined: Sun Aug 12, 2018 6:40 am

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by manigopal »

when will this ext gonna be live ? waiting for it.

@ phpbb 3.2x
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by martti »

manigopal wrote: Sun Nov 25, 2018 4:49 pm when will this ext gonna be live ? waiting for it.

@ phpbb 3.2x
You mean CDB? Not anytime soon. I'm busy with many other extensions as well. For all of them the testing period will be long.
Last edited by martti on Mon Nov 26, 2018 1:29 am, edited 1 time in total.
manigopal
Registered User
Posts: 163
Joined: Sun Aug 12, 2018 6:40 am

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by manigopal »

i'm not ext developer. try to make all your ext asap.
nou nou
Registered User
Posts: 494
Joined: Sat Oct 29, 2016 8:08 pm

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by nou nou »

manigopal wrote: Mon Nov 26, 2018 1:11 am i'm not ext developer. try to make all your ext asap.
Lol.
manigopal
Registered User
Posts: 163
Joined: Sun Aug 12, 2018 6:40 am

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by manigopal »

when the ext will come for live usage..waiting for long time
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by martti »

manigopal wrote: Sun Dec 30, 2018 8:36 am when the ext will come for live usage..waiting for long time
Why? What are you going to use it for?
manigopal
Registered User
Posts: 163
Joined: Sun Aug 12, 2018 6:40 am

Re: [3.2][BETA] Topic Prefix Tags (helper ext)

Post by manigopal »

to notify whats this of say for eg. [For 1.8]
@ https://community.mybb.com/forum-38-page-9.html
User avatar
martti
Registered User
Posts: 911
Joined: Thu Jul 31, 2014 8:23 am
Location: Belgium

Re: [3.3][BETA] Topic Prefix Tags (helper ext)

Post by martti »

Hi, this extension got updated for phpBB 3.3+ in version 0.4.0

The requirements for 0.4.0 are now:
  • phpBB 3.3+
  • PHP 7.1+
Post Reply

Return to “Extensions in Development”