@@ 498-515 (lines=18) @@ | ||
495 | * |
|
496 | * @return array|false Array of \ElggUser, or false, depending on success |
|
497 | */ |
|
498 | public function getFriends($options = array(), $limit = 10, $offset = 0) { |
|
499 | if (is_array($options)) { |
|
500 | $options['relationship'] = 'friend'; |
|
501 | $options['relationship_guid'] = $this->getGUID(); |
|
502 | $options['type'] = 'user'; |
|
503 | return elgg_get_entities_from_relationship($options); |
|
504 | } else { |
|
505 | elgg_deprecated_notice("\ElggUser::getFriends takes an options array", 1.9); |
|
506 | return elgg_get_entities_from_relationship(array( |
|
507 | 'relationship' => 'friend', |
|
508 | 'relationship_guid' => $this->guid, |
|
509 | 'type' => 'user', |
|
510 | 'subtype' => $options, |
|
511 | 'limit' => $limit, |
|
512 | 'offset' => $offset, |
|
513 | )); |
|
514 | } |
|
515 | } |
|
516 | ||
517 | /** |
|
518 | * Gets users who have made this user a friend |
|
@@ 529-547 (lines=19) @@ | ||
526 | * |
|
527 | * @return array|false Array of \ElggUser, or false, depending on success |
|
528 | */ |
|
529 | public function getFriendsOf($options = array(), $limit = 10, $offset = 0) { |
|
530 | if (is_array($options)) { |
|
531 | $options['relationship'] = 'friend'; |
|
532 | $options['relationship_guid'] = $this->getGUID(); |
|
533 | $options['inverse_relationship'] = true; |
|
534 | $options['type'] = 'user'; |
|
535 | return elgg_get_entities_from_relationship($options); |
|
536 | } else { |
|
537 | elgg_deprecated_notice("\ElggUser::getFriendsOf takes an options array", 1.9); |
|
538 | return elgg_get_entities_from_relationship(array( |
|
539 | 'relationship' => 'friend', |
|
540 | 'relationship_guid' => $this->guid, |
|
541 | 'type' => 'user', |
|
542 | 'subtype' => $options, |
|
543 | 'limit' => $limit, |
|
544 | 'offset' => $offset, |
|
545 | )); |
|
546 | } |
|
547 | } |
|
548 | ||
549 | /** |
|
550 | * Lists the user's friends |