Add variable to event

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
Toxyy
Registered User
Posts: 496
Joined: Mon Oct 24, 2016 3:22 pm

Add variable to event

Post by Toxyy » Thu Jul 12, 2018 10:26 pm

I need to add a variable to an event, rather than make a new one. It's trivial to do so, but would I just have to change the @since, and add the variable within the event, or would I have to add a second line with another @since? Viewforum.php, line 976. It would be solved if $replies could be changed to $topic_row['REPLIES'],as you can currently change the topic_row value but it has no impact on the next and last time $replies is used which is on like 976. So I'd either have to change that line, or add the replies variable to the event to do the same thing.

Edit: since the pagination on 976 uses two variables set in topicrow and those vars aren't used anywhere further I made a PR editing the pagination so that the event doesn't have to be changed, and people can edit the topicrow and it will automatically affect pagination.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

My extensions:
[3.2][BETA] Anonymous Posts

User avatar
Ger
Recognised Extension Developer
Posts: 1741
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Add variable to event

Post by Ger » Fri Jul 13, 2018 9:05 am

I have done it like this:
https://github.com/phpbb/phpbb/pull/5127/files

Since this one is merged I believe it's the best approach :)
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: No registered users and 11 guests