aboutsummaryrefslogtreecommitdiff
path: root/mod/riverdashboard/views/default/river/relationship/friend/create.php
blob: 916efd407e3264f46cd48f6d2d302232dc170921 (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
<?php
/**
 * Elgg relationship create event.
 * Display something in the river when a relationship is created.
 */

$statement = $vars['statement'];

$performed_by = $statement->getSubject();
$event = $statement->getEvent();
$object = $statement->getObject();

if (is_array($object)) {
	switch ($object['relationship']) {
		// Friending
		case 'friend' :
		case 'friends' : // 'friends' shouldn't be used, but just incase :)

			// Get second object
			$userb = $object['object'];

			// 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;
	}
}