aboutsummaryrefslogtreecommitdiff
path: root/views/default/river/ElggRelationship/create.php
blob: 95f27b512d9fa37017246c8a53a7cf859685a8b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
	/**
	 * Elgg relationship create event.
	 * Display something in the river when a relationship is created.
	 * 
	 * @package Elgg
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Marcus Povey
	 * @copyright Curverider Ltd 2008
	 * @link http://elgg.com/
	 */

	$performed_by = $vars['performed_by'];
	$log_entry = $vars['log_entry'];
	$object = $vars['object'];
	
	// Find out what type of relationship we're dealing with (will only display a few)
	if ($object instanceof ElggRelationship)
	{
		switch ($object->relationship)
		{
			// Friending
			case 'friend' :
			case 'friends' : // 'friends' shouldn't be used, but just incase :)
				
				// Get second object
				$userb = get_entity($object->guid_two);
				
				// Only users can be friends
				if (($performed_by instanceof ElggUser) && ($userb instanceof ElggUser))
				{
					// User A
					echo "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a> ";
				
					// Verb
					echo elgg_echo('river:relationship:friend');
				
					// user B
					echo " <a href=\"{$userb->getURL()}\">{$userb->name}</a>";
				}
				
			break;
		}
	}
		
?>