diff options
| author | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 10:00:38 -0700 | 
|---|---|---|
| committer | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 10:00:38 -0700 | 
| commit | dccc333c765bb28da55b4a55d9c916acdb88413a (patch) | |
| tree | bdd26a0b4cd85241a19b7fcb2c0770f0ac3eb9f0 /engine/lib/relationships.php | |
| parent | ec7b94a64aef23b85866ecdac8e8acc712d29bb6 (diff) | |
| parent | 003cb81c7888f4d2fd763e5814027c6f8d71186f (diff) | |
| download | elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.gz elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.bz2  | |
Merge branch 'master' of github.com:brettp/Elgg
Diffstat (limited to 'engine/lib/relationships.php')
| -rw-r--r-- | engine/lib/relationships.php | 33 | 
1 files changed, 13 insertions, 20 deletions
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index 5224efaf1..9d5fd39b6 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -593,38 +593,31 @@ function export_relationship_plugin_hook($hook, $entity_type, $returnvalue, $par  }  /** - * An event listener which will notify users based on certain events. + * Notify user that someone has friended them   * - * @param string $event       Event name - * @param string $object_type Object type - * @param mixed  $object      Object + * @param string $event  Event name + * @param string $type   Object type + * @param mixed  $object Object   *   * @return bool   */ -function relationship_notification_hook($event, $object_type, $object) { -	global $CONFIG; +function relationship_notification_hook($event, $type, $object) { -	if ( -		($object instanceof ElggRelationship) && -		($event == 'create') && -		($object_type == 'friend') -	) { -		$user_one = get_entity($object->guid_one); -		$user_two = get_entity($object->guid_two); +	$user_one = get_entity($object->guid_one); +	$user_two = get_entity($object->guid_two); -		// Notify target user -		return notify_user($object->guid_two, $object->guid_one, +	return notify_user($object->guid_two, +			$object->guid_one,  			elgg_echo('friend:newfriend:subject', array($user_one->name)),  			elgg_echo("friend:newfriend:body", array($user_one->name, $user_one->getURL())) -		); -	} +	);  } -/** Register the import hook */ +// Register the import hook  elgg_register_plugin_hook_handler("import", "all", "import_relationship_plugin_hook", 3); -/** Register the hook, ensuring entities are serialised first */ +// Register the hook, ensuring entities are serialised first  elgg_register_plugin_hook_handler("export", "all", "export_relationship_plugin_hook", 3); -/** Register event to listen to some events **/ +// Register event to listen to some events  elgg_register_event_handler('create', 'friend', 'relationship_notification_hook');  | 
