Question How to create a custom event trigger?

Status
Not open for further replies.

filetrip

Customer
Hello,

We are wondering if there is any way to create custom event triggers? (Xenforo 1.5)
I added an entry to the eventtrigger table, created an event for it. I also created a php file in src/addons/DBTech/Credits/Model/Event.
However, I dont know how to make it so the event is actually triggered.

What I'm trying to achieve:
- we have a custom application (home made) where people can ask questions. It's like yahoo questions
- I want to make it so when people post a question, they get 1 credit... and when their answer is selected as best answer they get 5 credits, etc...

Could you provide any pointers? For now everything I have done is kind of self taught / reverse engineered. I'm kind of "going in blind".
thanks in advance :)

PS: the addon isnt live yet on our site. We want to finish preparing the last event triggers before we start.
 
Look into how I fetch and trigger events by inspecting some of the XF class extensions. I’m not at my computer right now but I believe you can find some of them in library/DBTech/Credits/XenForo - the DiscussionMessage/Post one for instance :)
 
hi there!
thank you for your kind and fast reply :)

I have looked at this folder indeed but there are so many files in it... I dont know what they are for.

1524558360581.webp

do you know more specifically which folder I should look at?

i thought maybe EventListener? but it doesn't look like there are a lot of stuff in there:

1524558399119.webp

is it maybe in "Model" ?

1524558484124.webp


I tried looking at those files but they dont make any sense to me:

1524558598234.webp

I wanted to look at XFCP_DBTech_Credits_XenForo_Model_Like (red rectangle above) to understand what that class is, because a lot of calls in that file are calls to parent::something(), but I couldn't find class "XFCP_DBTech_Credits_XenForo_Model_Like" anywhere in the source code on the entire server (how is that possible?)
 
Thank you, indeed there is a bunch of interesting things in it.

also I now understand where this "XFCP" class comes from... https://xenforo.com/community/resources/understanding-the-xenforo-class-proxy-system.2080/ :)
I assumed it was an autoloader, I just didnt know it worked that way.

What do you think I should do:

Option 1: code my custom credit-awarding event inside the code of my existing addon (the "questions" addon where I'm trying to give points)

or

Option 2: create a new .php file inside your addon (DBtech credits) which will work the same way as what you pointed me to - some kind of XFCP_ class


Either way, if you're interested, once the addon goes live on our site, I can show you what we've done. I wonder if the addon has been used before the same we're about to use it. It's a really nice addon, to say the least.
 
I'd say the best thing to do would be to add it to your existing addon, that way you don't have to worry about the files being overwritten :)
 
Hello @filetrip,

We hope your ticket regarding DragonByte Credits has been addressed to your satisfaction. This ticket has now been closed.

If your ticket has not been resolved, you can reply to this thread at any point in the next 7 days in order to reopen the ticket, afterwards this thread will be closed.

Please do not reply to this thread if your ticket has been resolved.

Thank you.


- DragonByte Technologies, Ltd.
 
Status
Not open for further replies.

DragonByte Credits

XenForo 1.5.3+ XenForo 2.0.x XenForo 2.1.x XenForo 2.2.x XenForo 2.3.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
4,885
Customer rating
5.00 star(s) 5 ratings
Back
Top