1 | <?php |
||
2 | /** |
||
3 | * View a collection |
||
4 | */ |
||
5 | |||
6 | use Elgg\Exceptions\Http\EntityNotFoundException; |
||
7 | use Elgg\Exceptions\Http\EntityPermissionsException; |
||
8 | |||
9 | $collection_id = (int) elgg_extract('collection_id', $vars); |
||
10 | |||
11 | $collection = elgg_get_access_collection($collection_id); |
||
12 | if (!$collection instanceof \ElggAccessCollection || !$collection->canEdit()) { |
||
13 | // We don't want to leak friendship/collection information |
||
14 | throw new EntityPermissionsException(); |
||
15 | } |
||
16 | |||
17 | $user = $collection->getOwnerEntity(); |
||
18 | if (!$user instanceof \ElggUser) { |
||
19 | throw new EntityNotFoundException(); |
||
20 | } |
||
21 | |||
22 | elgg_set_page_owner_guid($user->guid); |
||
23 | |||
24 | elgg_push_breadcrumb(elgg_echo('friends:collections'), elgg_generate_url('collection:access_collection:friends:owner', ['username' => $user->username])); |
||
1 ignored issue
–
show
Bug
introduced
by
Loading history...
|
|||
25 | |||
26 | echo elgg_view_page($collection->getDisplayName(), [ |
||
27 | 'content' => elgg_view('collections/collection', [ |
||
28 | 'full_view' => true, |
||
29 | 'item' => $collection, |
||
30 | ]), |
||
31 | 'filter_id' => 'friends_collections/view', |
||
32 | ]); |
||
33 |