Events

Please note: This page is under construction and has not been finished yet.

Introduction

Plugin developers can hook into various e107 core events and trigger functions of their own. Typically, an e_event.php file is used to store this information since it is loaded with every page.

From e107 version 2.1.2 onwards you can use e_event.php addon to catch the events instead of using e_module.php

Events methods

register()

Parameter
Description
Mandatory?

name

The event you wish to hook into. (see tables below)

Yes

function

Your function or class/method to trigger when this event occurs. string for function, or for classes use an array (class, method).

Yes

include

include (optional) path: a file to include if required.

No

e107::getEvent()->register(name, function, include);

Example 1: trigger myFunction() on user login.

e107::getEvent()->register('login', 'myFunction'); 

function myFunction($data)
{
   // do something    
}

Example 2: trigger myFunction() on user login. Function in external file.

e107::getEvent()->register('login', 'myFunction',  e_PLUGIN."myplugin/myFunctions.php");

Example 3: trigger a class and method on user login.

e107::getEvent()->register('login', array('myClass', 'myMethod'),  e_PLUGIN."myplugin/myClass.php");

trigger()

Triggers an event. This can be used by plugin authors to create their own plugin events that other developers can hook into.

e107::getEvent()->trigger($eventname, $data = '');

// Example for plugin authors to create their own plugin event:
e107::getEvent()->trigger("plugindir_customevent", $data = ''); // plugindir is the name of the plugin folder
Parameter
Description
Mandatory?

eventname

The name of the event you wish to trigger (new event name). Format: plugindir_eventname (see example above).

Yes

data

The data that you wish to send alongside the event

No

Core Event triggers

User Event Triggers

Basic user functions

Trigger Name
Description
Data

login

User login/signin

Array of user data

logout

User logout/signout

Notice event

user_file_upload

User uploads a file

Array of file information

user_signup_submitted

User submits signup form

Array of user data

user_signup_activated

User activates newly created account. (email link)

Array of user data

user_xup_login

User signs in via a social media account. eg. Facebook, Twitter etc.

Array of user data

user_xup_signup

User creates an account using their social media login. Facebook, Twitter etc.

Array of user data

user_profile_display

User has viewed a profile

Array of data

user_profile_edit

User has edited their profile

Array of data of user who changed the settings

user_comment_posted

User has posted a new comment

Array of data

preuserset

Before usersettings are updated

Array of new user settings ($_POST)

postuserset

After usersettings are updated

Array of new user settings ($_POST)

userdatachanged

After usersettings are updated (same time and data as user_profile_edit)

Array of data of user who changed the settings

Custom page

Trigger function
Description
Data

user_page_item_viewed

User has viewed a custom page

Array of data

News

Trigger Name
Description
Data

user_news_item_viewed

User viewed a news item

Array of data

user_news_submit

User submitted a news item

Array of data

Private Messenger

Trigger name
Description
Data

user_pm_sent

User has sent a private message

Array of data

user_pm_read

User has read a private message

Array of data

Forum

Trigger Name
Description
Data

user_forum_topic_created

User creates a forum topic

Array of data

user_forum_topic_created_probationary

New user creates a forum topic

Array of data

user_forum_topic_updated

User updates a forum topic

Array of data

user_forum_topic_deleted

User deletes a forum topic

Array of data

user_forum_topic_moved

User has moved forum topic to a different forum

Array of data

user_forum_topic_split

User has split the forum topic

Array of data

user_forum_post_created

User creates a forum post/reply

Array of data

user_forum_post_updated

User updates a forum post/reply

Array of data

user_forum_post_deleted

User deletes a forum post/reply

Array of data

user_forum_post_report

User has reported a forum post/reply

Array of data

Chatbox

Trigger function
Description
Data

user_chatbox_post_created

User has posted a chatbox message

Array of data (ip and message)

Admin Event Triggers

Admin changes their password

Trigger Name
Description
Data

admin_password_update

Admin updates their password

Array containing user_id and time of change.

Comments Manager

Trigger Name
Description
Data

admin_comment_update

Admin updates a comment

Array of comment data

admin_comment_delete

Admin deletes a comment

Array of comment data

Downloads

Trigger Name
Description
Data

admin_download_create

Admin creates a download item

Array of download data

admin_download_update

Admin updates a download item

Array of download data

admin_download_delete

Admin deletes a download item

Array of download data

News

Trigger Name
Description
Data

admin_news_create

Admin creates a news item

Array of news data

admin_news_update

Admin updates a news item

Array of news data

admin_news_delete

Admin deletes a news item

Array of news data

admin_news_category_create

Admin creates a news category

Array of news data

admin_news_category_update

Admin updates a news category

Array of news data

admin_news_category_delete

Admin deletes a news category

Array of news data

Pages

Trigger Name
Description
Data

admin_page_create

Admin creates a page/menu item

Array of page data

admin_page_update

Admin updates a page/menu item

Array of page data (new and old)

admin_page_delete

Admin deletes a page/menu item

Array of page data

Users

Trigger Name
Description
Data

admin_user_create

Admin creates a new user

Array of user data

admin_user_update

Admin modifies user data

Array of user data (new and old)

admin_user_delete

Admin deletes a user

Array of user data

admin_user_activate

Admin activates an unverified user

Array of user data

admin_user_loginas

Admin logs in as another user

Array of user data

admin_user_logoutas

Admin logs out as another user

Array of user data

Last updated