Skip to content

custom plugin events #4828

Answered by Moc
3l3ktr0n asked this question in Q&A Plugins
Jul 24, 2022 · 3 comments · 10 replies
Discussion options

You must be logged in to vote

Yes. Simply call the event anywhere in your code by using e107::getEvent()->trigger('myplugin_customevent', $data).

  • myplugin is your plugin folder name
  • customevent is a unique event name

You do not necessarily need to add your custom plugin event to YOUR e_event addon. If you trigger it somewhere in your code, other plugins can "listen" to your custom event by defining it in THEIR e_event addon.


OPTIONALLY:
If you want to LISTEN to your OWN custom event and run a function when it is triggered, then also add the custom event your e_event.php addon, within the config() method. Also add the method that you want to run on that event.

For example:

function config()
{
	$event = array();

	$e…

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
7 replies
@Jimmi08
Comment options

@3l3ktr0n
Comment options

@Jimmi08
Comment options

@3l3ktr0n
Comment options

@Jimmi08
Comment options

Comment options

You must be logged in to vote
3 replies
@3l3ktr0n
Comment options

@Moc
Comment options

@Moc
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Moc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment