diff options
author | redmatrix <git@macgirvin.com> | 2016-08-14 18:22:18 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-08-14 18:22:18 -0700 |
commit | 000861da0dd68a94d67da15301eab7fd2df3cc1a (patch) | |
tree | 44543e0966ae8e6af375408009dcbad0f56ac793 | |
parent | 7ae097ef6b59083db9fe9134d10815a2b329b542 (diff) | |
download | volse-hubzilla-000861da0dd68a94d67da15301eab7fd2df3cc1a.tar.gz volse-hubzilla-000861da0dd68a94d67da15301eab7fd2df3cc1a.tar.bz2 volse-hubzilla-000861da0dd68a94d67da15301eab7fd2df3cc1a.zip |
event_store_event hook
-rw-r--r-- | doc/hook/event_store_event.bb | 11 | ||||
-rw-r--r-- | doc/hooklist.bb | 3 | ||||
-rw-r--r-- | include/event.php | 7 |
3 files changed, 21 insertions, 0 deletions
diff --git a/doc/hook/event_store_event.bb b/doc/hook/event_store_event.bb new file mode 100644 index 000000000..7015a8322 --- /dev/null +++ b/doc/hook/event_store_event.bb @@ -0,0 +1,11 @@ +[h2]event_store_event[/h2] + +Called from event_store_event() when an event record is being stored. + +Hook info is an array + +'event' => the passed event details, ready for storage +'existing_event' => If the event already exists, a copy of the original event record from the database +'cancel' => false - set to true to cancel the operation. + + diff --git a/doc/hooklist.bb b/doc/hooklist.bb index 66ff1cf71..858a7d021 100644 --- a/doc/hooklist.bb +++ b/doc/hooklist.bb @@ -184,6 +184,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the [zrl=[baseurl]/help/hook/event_created]event_created[/zrl] called when an event record is created +[zrl=[baseurl]/help/hook/event_store_event]event_store_event[/zrl] + called when an event record is created or updated + [zrl=[baseurl]/help/hook/event_updated]event_updated[/zrl] called when an event record is modified diff --git a/include/event.php b/include/event.php index 3d650cd14..407736a23 100644 --- a/include/event.php +++ b/include/event.php @@ -343,6 +343,13 @@ function event_store_event($arr) { } } + $hook_info = [ 'event' => $arr, 'existing_event' => $existing_event, 'cancel' => false ]; + call_hooks('event_store_event',$hook_info); + if($hook_info['cancel']) + return false; + + $arr = $hook_info['event']; + $existing_event = $hook_info['existing_event']; if($existing_event) { |