{"action":"created","comment":{"url":"https://api.github.com/repos/Elgg/Elgg/pulls/comments/28132983","id":28132983,"diff_hunk":"@@ -1068,6 +1068,47 @@ public function canEdit($user_guid = 0) {\n \t}\n \n \t/**\n+\t * Can a user delete this entity?\n+\t *\n+\t * @tip Can be overridden by registering for the permissions_check:delete plugin hook.\n+\t *\n+\t * @param int $user_guid The user GUID, optionally (default: logged in user)\n+\t *\n+\t * @return bool Whether this entity is deletable by the given user.\n+\t * @since 1.11\n+\t * @see elgg_set_ignore_access()\n+\t */\n+\tpublic function canDelete($user_guid = 0) {\n+\t\t$user_guid = (int) $user_guid;\n+\n+\t\tif (!$user_guid) {\n+\t\t\t$user_guid = _elgg_services()->session->getLoggedInUserGuid();\n+\t\t}\n+\n+\t\t// need to ignore access and show hidden entities for potential hidden/disabled users\n+\t\t$ia = elgg_set_ignore_access(true);\n+\t\t$show_hidden = access_show_hidden_entities(true);\n+\t\t\n+\t\t$user = _elgg_services()->entityTable->get($user_guid, 'user');","path":"engine/classes/ElggEntity.php","position":25,"original_position":25,"commit_id":"8e2084f8b48ac395f4c7ffbdc81c2aafcdbbea62","original_commit_id":"8e2084f8b48ac395f4c7ffbdc81c2aafcdbbea62","user":{"login":"hypeJunction","id":1202761,"avatar_url":"https://avatars.githubusercontent.com/u/1202761?v=3","gravatar_id":"","url":"https://api.github.com/users/hypeJunction","html_url":"https://github.com/hypeJunction","followers_url":"https://api.github.com/users/hypeJunction/followers","following_url":"https://api.github.com/users/hypeJunction/following{/other_user}","gists_url":"https://api.github.com/users/hypeJunction/gists{/gist_id}","starred_url":"https://api.github.com/users/hypeJunction/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hypeJunction/subscriptions","organizations_url":"https://api.github.com/users/hypeJunction/orgs","repos_url":"https://api.github.com/users/hypeJunction/repos","events_url":"https://api.github.com/users/hypeJunction/events{/privacy}","received_events_url":"https://api.github.com/users/hypeJunction/received_events","type":"User","site_admin":false},"body":"Does this load all the metadata? The problem I see is that someone trying to check some metadata value in the plugin hook handler to make a decision on the capability and that metadata not yet being loaded.","created_at":"2015-04-10T09:46:07Z","updated_at":"2015-04-10T09:46:07Z","html_url":"https://github.com/Elgg/Elgg/pull/8031#discussion_r28132983","pull_request_url":"https://api.github.com/repos/Elgg/Elgg/pulls/8031","_links":{"self":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/comments/28132983"},"html":{"href":"https://github.com/Elgg/Elgg/pull/8031#discussion_r28132983"},"pull_request":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/8031"}}},"pull_request":{"url":"https://api.github.com/repos/Elgg/Elgg/pulls/8031","id":30538027,"html_url":"https://github.com/Elgg/Elgg/pull/8031","diff_url":"https://github.com/Elgg/Elgg/pull/8031.diff","patch_url":"https://github.com/Elgg/Elgg/pull/8031.patch","issue_url":"https://api.github.com/repos/Elgg/Elgg/issues/8031","number":8031,"state":"open","locked":false,"title":"feature(engine): added a canDelete function to the entity class","user":{"login":"jdalsem","id":861833,"avatar_url":"https://avatars.githubusercontent.com/u/861833?v=3","gravatar_id":"","url":"https://api.github.com/users/jdalsem","html_url":"https://github.com/jdalsem","followers_url":"https://api.github.com/users/jdalsem/followers","following_url":"https://api.github.com/users/jdalsem/following{/other_user}","gists_url":"https://api.github.com/users/jdalsem/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalsem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalsem/subscriptions","organizations_url":"https://api.github.com/users/jdalsem/orgs","repos_url":"https://api.github.com/users/jdalsem/repos","events_url":"https://api.github.com/users/jdalsem/events{/privacy}","received_events_url":"https://api.github.com/users/jdalsem/received_events","type":"User","site_admin":false},"body":"fixes #2975","created_at":"2015-03-05T08:25:01Z","updated_at":"2015-04-10T09:46:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"56cda3d3efd0c17ed98ca405c34656085b4acad1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Elgg/Elgg/pulls/8031/commits","review_comments_url":"https://api.github.com/repos/Elgg/Elgg/pulls/8031/comments","review_comment_url":"https://api.github.com/repos/Elgg/Elgg/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Elgg/Elgg/issues/8031/comments","statuses_url":"https://api.github.com/repos/Elgg/Elgg/statuses/8e2084f8b48ac395f4c7ffbdc81c2aafcdbbea62","head":{"label":"jdalsem:can-delete","ref":"can-delete","sha":"8e2084f8b48ac395f4c7ffbdc81c2aafcdbbea62","user":{"login":"jdalsem","id":861833,"avatar_url":"https://avatars.githubusercontent.com/u/861833?v=3","gravatar_id":"","url":"https://api.github.com/users/jdalsem","html_url":"https://github.com/jdalsem","followers_url":"https://api.github.com/users/jdalsem/followers","following_url":"https://api.github.com/users/jdalsem/following{/other_user}","gists_url":"https://api.github.com/users/jdalsem/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalsem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalsem/subscriptions","organizations_url":"https://api.github.com/users/jdalsem/orgs","repos_url":"https://api.github.com/users/jdalsem/repos","events_url":"https://api.github.com/users/jdalsem/events{/privacy}","received_events_url":"https://api.github.com/users/jdalsem/received_events","type":"User","site_admin":false},"repo":{"id":3067967,"name":"Elgg","full_name":"jdalsem/Elgg","owner":{"login":"jdalsem","id":861833,"avatar_url":"https://avatars.githubusercontent.com/u/861833?v=3","gravatar_id":"","url":"https://api.github.com/users/jdalsem","html_url":"https://github.com/jdalsem","followers_url":"https://api.github.com/users/jdalsem/followers","following_url":"https://api.github.com/users/jdalsem/following{/other_user}","gists_url":"https://api.github.com/users/jdalsem/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalsem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalsem/subscriptions","organizations_url":"https://api.github.com/users/jdalsem/orgs","repos_url":"https://api.github.com/users/jdalsem/repos","events_url":"https://api.github.com/users/jdalsem/events{/privacy}","received_events_url":"https://api.github.com/users/jdalsem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdalsem/Elgg","description":"A social networking engine","fork":true,"url":"https://api.github.com/repos/jdalsem/Elgg","forks_url":"https://api.github.com/repos/jdalsem/Elgg/forks","keys_url":"https://api.github.com/repos/jdalsem/Elgg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdalsem/Elgg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdalsem/Elgg/teams","hooks_url":"https://api.github.com/repos/jdalsem/Elgg/hooks","issue_events_url":"https://api.github.com/repos/jdalsem/Elgg/issues/events{/number}","events_url":"https://api.github.com/repos/jdalsem/Elgg/events","assignees_url":"https://api.github.com/repos/jdalsem/Elgg/assignees{/user}","branches_url":"https://api.github.com/repos/jdalsem/Elgg/branches{/branch}","tags_url":"https://api.github.com/repos/jdalsem/Elgg/tags","blobs_url":"https://api.github.com/repos/jdalsem/Elgg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdalsem/Elgg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdalsem/Elgg/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdalsem/Elgg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdalsem/Elgg/statuses/{sha}","languages_url":"https://api.github.com/repos/jdalsem/Elgg/languages","stargazers_url":"https://api.github.com/repos/jdalsem/Elgg/stargazers","contributors_url":"https://api.github.com/repos/jdalsem/Elgg/contributors","subscribers_url":"https://api.github.com/repos/jdalsem/Elgg/subscribers","subscription_url":"https://api.github.com/repos/jdalsem/Elgg/subscription","commits_url":"https://api.github.com/repos/jdalsem/Elgg/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdalsem/Elgg/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdalsem/Elgg/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdalsem/Elgg/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdalsem/Elgg/contents/{+path}","compare_url":"https://api.github.com/repos/jdalsem/Elgg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdalsem/Elgg/merges","archive_url":"https://api.github.com/repos/jdalsem/Elgg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdalsem/Elgg/downloads","issues_url":"https://api.github.com/repos/jdalsem/Elgg/issues{/number}","pulls_url":"https://api.github.com/repos/jdalsem/Elgg/pulls{/number}","milestones_url":"https://api.github.com/repos/jdalsem/Elgg/milestones{/number}","notifications_url":"https://api.github.com/repos/jdalsem/Elgg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdalsem/Elgg/labels{/name}","releases_url":"https://api.github.com/repos/jdalsem/Elgg/releases{/id}","created_at":"2011-12-29T09:43:57Z","updated_at":"2014-06-24T10:31:40Z","pushed_at":"2015-04-10T09:22:40Z","git_url":"git://github.com/jdalsem/Elgg.git","ssh_url":"git@github.com:jdalsem/Elgg.git","clone_url":"https://github.com/jdalsem/Elgg.git","svn_url":"https://github.com/jdalsem/Elgg","homepage":"http://elgg.org","size":39757,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"Elgg:1.x","ref":"1.x","sha":"251022fbb9178fce16b39c49716dc556acebb25e","user":{"login":"Elgg","id":79167,"avatar_url":"https://avatars.githubusercontent.com/u/79167?v=3","gravatar_id":"","url":"https://api.github.com/users/Elgg","html_url":"https://github.com/Elgg","followers_url":"https://api.github.com/users/Elgg/followers","following_url":"https://api.github.com/users/Elgg/following{/other_user}","gists_url":"https://api.github.com/users/Elgg/gists{/gist_id}","starred_url":"https://api.github.com/users/Elgg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elgg/subscriptions","organizations_url":"https://api.github.com/users/Elgg/orgs","repos_url":"https://api.github.com/users/Elgg/repos","events_url":"https://api.github.com/users/Elgg/events{/privacy}","received_events_url":"https://api.github.com/users/Elgg/received_events","type":"Organization","site_admin":false},"repo":{"id":299271,"name":"Elgg","full_name":"Elgg/Elgg","owner":{"login":"Elgg","id":79167,"avatar_url":"https://avatars.githubusercontent.com/u/79167?v=3","gravatar_id":"","url":"https://api.github.com/users/Elgg","html_url":"https://github.com/Elgg","followers_url":"https://api.github.com/users/Elgg/followers","following_url":"https://api.github.com/users/Elgg/following{/other_user}","gists_url":"https://api.github.com/users/Elgg/gists{/gist_id}","starred_url":"https://api.github.com/users/Elgg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elgg/subscriptions","organizations_url":"https://api.github.com/users/Elgg/orgs","repos_url":"https://api.github.com/users/Elgg/repos","events_url":"https://api.github.com/users/Elgg/events{/privacy}","received_events_url":"https://api.github.com/users/Elgg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Elgg/Elgg","description":"A social networking engine in PHP/MySQL","fork":false,"url":"https://api.github.com/repos/Elgg/Elgg","forks_url":"https://api.github.com/repos/Elgg/Elgg/forks","keys_url":"https://api.github.com/repos/Elgg/Elgg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Elgg/Elgg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Elgg/Elgg/teams","hooks_url":"https://api.github.com/repos/Elgg/Elgg/hooks","issue_events_url":"https://api.github.com/repos/Elgg/Elgg/issues/events{/number}","events_url":"https://api.github.com/repos/Elgg/Elgg/events","assignees_url":"https://api.github.com/repos/Elgg/Elgg/assignees{/user}","branches_url":"https://api.github.com/repos/Elgg/Elgg/branches{/branch}","tags_url":"https://api.github.com/repos/Elgg/Elgg/tags","blobs_url":"https://api.github.com/repos/Elgg/Elgg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Elgg/Elgg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Elgg/Elgg/git/refs{/sha}","trees_url":"https://api.github.com/repos/Elgg/Elgg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Elgg/Elgg/statuses/{sha}","languages_url":"https://api.github.com/repos/Elgg/Elgg/languages","stargazers_url":"https://api.github.com/repos/Elgg/Elgg/stargazers","contributors_url":"https://api.github.com/repos/Elgg/Elgg/contributors","subscribers_url":"https://api.github.com/repos/Elgg/Elgg/subscribers","subscription_url":"https://api.github.com/repos/Elgg/Elgg/subscription","commits_url":"https://api.github.com/repos/Elgg/Elgg/commits{/sha}","git_commits_url":"https://api.github.com/repos/Elgg/Elgg/git/commits{/sha}","comments_url":"https://api.github.com/repos/Elgg/Elgg/comments{/number}","issue_comment_url":"https://api.github.com/repos/Elgg/Elgg/issues/comments{/number}","contents_url":"https://api.github.com/repos/Elgg/Elgg/contents/{+path}","compare_url":"https://api.github.com/repos/Elgg/Elgg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Elgg/Elgg/merges","archive_url":"https://api.github.com/repos/Elgg/Elgg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Elgg/Elgg/downloads","issues_url":"https://api.github.com/repos/Elgg/Elgg/issues{/number}","pulls_url":"https://api.github.com/repos/Elgg/Elgg/pulls{/number}","milestones_url":"https://api.github.com/repos/Elgg/Elgg/milestones{/number}","notifications_url":"https://api.github.com/repos/Elgg/Elgg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Elgg/Elgg/labels{/name}","releases_url":"https://api.github.com/repos/Elgg/Elgg/releases{/id}","created_at":"2009-09-06T17:10:11Z","updated_at":"2015-04-07T19:49:17Z","pushed_at":"2015-04-10T09:24:08Z","git_url":"git://github.com/Elgg/Elgg.git","ssh_url":"git@github.com:Elgg/Elgg.git","clone_url":"https://github.com/Elgg/Elgg.git","svn_url":"https://github.com/Elgg/Elgg","homepage":"http://elgg.org","size":74701,"stargazers_count":694,"watchers_count":694,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":422,"mirror_url":null,"open_issues_count":760,"forks":422,"open_issues":760,"watchers":694,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/8031"},"html":{"href":"https://github.com/Elgg/Elgg/pull/8031"},"issue":{"href":"https://api.github.com/repos/Elgg/Elgg/issues/8031"},"comments":{"href":"https://api.github.com/repos/Elgg/Elgg/issues/8031/comments"},"review_comments":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/8031/comments"},"review_comment":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/8031/commits"},"statuses":{"href":"https://api.github.com/repos/Elgg/Elgg/statuses/8e2084f8b48ac395f4c7ffbdc81c2aafcdbbea62"}}}}