Add variable to event

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

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 || [3.2][BETA] Sticky Ad || [3.2][RC] Show User Activity ||
[3.2][DEV] User Delete Topics

User avatar
Recognised Extension Developer
Posts: 1882
Joined: Wed Jan 02, 2008 7:35 pm

Re: Add variable to event

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

I have done it like this:

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”