Elgg  Version 1.9
all.php
Go to the documentation of this file.
1 <?php
9 elgg_register_event_handler('all', 'object', 'example_event_handler');
10 
11 // This function will be called for any event of type 'object'
12 function example_event_handler($event, $type, $object) {
13  // check what sort of object is passed
14  if ($object instanceof ElggObject) {
15  $subtype = $object->getSubtype();
16 
17  switch ($subtype) {
18  case 'blog':
19  case 'thewire':
20  case 'pages':
21  // prevent these object subtypes from being saved or changed
22  return false;
23  default:
24  return true;
25  }
26 
27  }
28 
29  return true;
30 }
$object
Definition: upgrade.php:12
$type
Definition: add.php:8
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
Register a callback as an Elgg event handler.
Definition: elgglib.php:669
example_event_handler($event, $type, $object)
Definition: all.php:12
$subtype
Definition: river.php:10
Elgg Object.
Definition: ElggObject.php:22