{"action":"created","comment":{"url":"https://api.github.com/repos/woocommerce/woocommerce/pulls/comments/205417176","pull_request_review_id":140680394,"id":205417176,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTQxNzE3Ng==","diff_hunk":"@@ -61,12 +61,12 @@ public function create( &$download ) {\n \t\t\tapply_filters( 'woocommerce_downloadable_file_permission_format', $format, $data )\n \t\t);\n \n-\t\tdo_action( 'woocommerce_grant_product_download_access', $data );\n-\n \t\tif ( $result ) {\n \t\t\t$download->set_id( $wpdb->insert_id );\n \t\t\t$download->apply_changes();\n \t\t}\n+\n+\t\tdo_action( 'woocommerce_grant_product_download_access', $data );","path":"includes/data-stores/class-wc-customer-download-data-store.php","position":11,"original_position":11,"commit_id":"4fc06834b6be29cc657b60ed35a9f17ee951b3dc","original_commit_id":"4fc06834b6be29cc657b60ed35a9f17ee951b3dc","user":{"login":"gedex","id":78313,"node_id":"MDQ6VXNlcjc4MzEz","avatar_url":"https://avatars2.githubusercontent.com/u/78313?v=4","gravatar_id":"","url":"https://api.github.com/users/gedex","html_url":"https://github.com/gedex","followers_url":"https://api.github.com/users/gedex/followers","following_url":"https://api.github.com/users/gedex/following{/other_user}","gists_url":"https://api.github.com/users/gedex/gists{/gist_id}","starred_url":"https://api.github.com/users/gedex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gedex/subscriptions","organizations_url":"https://api.github.com/users/gedex/orgs","repos_url":"https://api.github.com/users/gedex/repos","events_url":"https://api.github.com/users/gedex/events{/privacy}","received_events_url":"https://api.github.com/users/gedex/received_events","type":"User","site_admin":false},"body":"it seems the fatal error you got is caused by download ID not being set properly at that time.\r\n\r\nThe hook should be inside the `if ( $result )`. Otherwise you'd get fatal error again if `$wpdb->insert` is failed.\r\n\r\n","created_at":"2018-07-26T11:10:26Z","updated_at":"2018-07-26T11:10:26Z","html_url":"https://github.com/woocommerce/woocommerce/pull/20905#discussion_r205417176","pull_request_url":"https://api.github.com/repos/woocommerce/woocommerce/pulls/20905","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/woocommerce/woocommerce/pulls/comments/205417176"},"html":{"href":"https://github.com/woocommerce/woocommerce/pull/20905#discussion_r205417176"},"pull_request":{"href":"https://api.github.com/repos/woocommerce/woocommerce/pulls/20905"}}},"pull_request":{"url":"https://api.github.com/repos/woocommerce/woocommerce/pulls/20905","id":204086750,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0MDg2NzUw","html_url":"https://github.com/woocommerce/woocommerce/pull/20905","diff_url":"https://github.com/woocommerce/woocommerce/pull/20905.diff","patch_url":"https://github.com/woocommerce/woocommerce/pull/20905.patch","issue_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/20905","number":20905,"state":"open","locked":false,"title":"Fixes an issue with the 'woocommerce_grant_product_download_access' hook","user":{"login":"kanishkdudeja","id":3773215,"node_id":"MDQ6VXNlcjM3NzMyMTU=","avatar_url":"https://avatars1.githubusercontent.com/u/3773215?v=4","gravatar_id":"","url":"https://api.github.com/users/kanishkdudeja","html_url":"https://github.com/kanishkdudeja","followers_url":"https://api.github.com/users/kanishkdudeja/followers","following_url":"https://api.github.com/users/kanishkdudeja/following{/other_user}","gists_url":"https://api.github.com/users/kanishkdudeja/gists{/gist_id}","starred_url":"https://api.github.com/users/kanishkdudeja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kanishkdudeja/subscriptions","organizations_url":"https://api.github.com/users/kanishkdudeja/orgs","repos_url":"https://api.github.com/users/kanishkdudeja/repos","events_url":"https://api.github.com/users/kanishkdudeja/events{/privacy}","received_events_url":"https://api.github.com/users/kanishkdudeja/received_events","type":"User","site_admin":false},"body":"Fixes #20904 \r\n\r\ncc @mattyza @gedex \r\n\r\n### Changes proposed in this Pull Request:\r\n\r\nThis PR just moves the following line:\r\n\r\n`do_action( 'woocommerce_grant_product_download_access', $data );`\r\n\r\nto the bottom of the `create()` function in the `WC_Customer_Download_Data_Store` class.\r\n\r\n### How to test the changes in this Pull Request:\r\n\r\nProvided in #20904 \r\n\r\n### Changelog entry\r\n\r\n> Fixes an issue with the `woocommerce_grant_product_download_access` hook","created_at":"2018-07-26T09:49:53Z","updated_at":"2018-07-26T11:10:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"426acb1574ffe23c855d7a75e6b36b88932391a1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/woocommerce/woocommerce/pulls/20905/commits","review_comments_url":"https://api.github.com/repos/woocommerce/woocommerce/pulls/20905/comments","review_comment_url":"https://api.github.com/repos/woocommerce/woocommerce/pulls/comments{/number}","comments_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/20905/comments","statuses_url":"https://api.github.com/repos/woocommerce/woocommerce/statuses/4fc06834b6be29cc657b60ed35a9f17ee951b3dc","head":{"label":"woocommerce:fix/20904","ref":"fix/20904","sha":"4fc06834b6be29cc657b60ed35a9f17ee951b3dc","user":{"login":"woocommerce","id":473596,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/473596?v=4","gravatar_id":"","url":"https://api.github.com/users/woocommerce","html_url":"https://github.com/woocommerce","followers_url":"https://api.github.com/users/woocommerce/followers","following_url":"https://api.github.com/users/woocommerce/following{/other_user}","gists_url":"https://api.github.com/users/woocommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/woocommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woocommerce/subscriptions","organizations_url":"https://api.github.com/users/woocommerce/orgs","repos_url":"https://api.github.com/users/woocommerce/repos","events_url":"https://api.github.com/users/woocommerce/events{/privacy}","received_events_url":"https://api.github.com/users/woocommerce/received_events","type":"Organization","site_admin":false},"repo":{"id":2179920,"node_id":"MDEwOlJlcG9zaXRvcnkyMTc5OTIw","name":"woocommerce","full_name":"woocommerce/woocommerce","owner":{"login":"woocommerce","id":473596,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/473596?v=4","gravatar_id":"","url":"https://api.github.com/users/woocommerce","html_url":"https://github.com/woocommerce","followers_url":"https://api.github.com/users/woocommerce/followers","following_url":"https://api.github.com/users/woocommerce/following{/other_user}","gists_url":"https://api.github.com/users/woocommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/woocommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woocommerce/subscriptions","organizations_url":"https://api.github.com/users/woocommerce/orgs","repos_url":"https://api.github.com/users/woocommerce/repos","events_url":"https://api.github.com/users/woocommerce/events{/privacy}","received_events_url":"https://api.github.com/users/woocommerce/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/woocommerce/woocommerce","description":"An open source eCommerce plugin for WordPress.","fork":false,"url":"https://api.github.com/repos/woocommerce/woocommerce","forks_url":"https://api.github.com/repos/woocommerce/woocommerce/forks","keys_url":"https://api.github.com/repos/woocommerce/woocommerce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/woocommerce/woocommerce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/woocommerce/woocommerce/teams","hooks_url":"https://api.github.com/repos/woocommerce/woocommerce/hooks","issue_events_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/events{/number}","events_url":"https://api.github.com/repos/woocommerce/woocommerce/events","assignees_url":"https://api.github.com/repos/woocommerce/woocommerce/assignees{/user}","branches_url":"https://api.github.com/repos/woocommerce/woocommerce/branches{/branch}","tags_url":"https://api.github.com/repos/woocommerce/woocommerce/tags","blobs_url":"https://api.github.com/repos/woocommerce/woocommerce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/woocommerce/woocommerce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/woocommerce/woocommerce/git/refs{/sha}","trees_url":"https://api.github.com/repos/woocommerce/woocommerce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/woocommerce/woocommerce/statuses/{sha}","languages_url":"https://api.github.com/repos/woocommerce/woocommerce/languages","stargazers_url":"https://api.github.com/repos/woocommerce/woocommerce/stargazers","contributors_url":"https://api.github.com/repos/woocommerce/woocommerce/contributors","subscribers_url":"https://api.github.com/repos/woocommerce/woocommerce/subscribers","subscription_url":"https://api.github.com/repos/woocommerce/woocommerce/subscription","commits_url":"https://api.github.com/repos/woocommerce/woocommerce/commits{/sha}","git_commits_url":"https://api.github.com/repos/woocommerce/woocommerce/git/commits{/sha}","comments_url":"https://api.github.com/repos/woocommerce/woocommerce/comments{/number}","issue_comment_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/comments{/number}","contents_url":"https://api.github.com/repos/woocommerce/woocommerce/contents/{+path}","compare_url":"https://api.github.com/repos/woocommerce/woocommerce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/woocommerce/woocommerce/merges","archive_url":"https://api.github.com/repos/woocommerce/woocommerce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/woocommerce/woocommerce/downloads","issues_url":"https://api.github.com/repos/woocommerce/woocommerce/issues{/number}","pulls_url":"https://api.github.com/repos/woocommerce/woocommerce/pulls{/number}","milestones_url":"https://api.github.com/repos/woocommerce/woocommerce/milestones{/number}","notifications_url":"https://api.github.com/repos/woocommerce/woocommerce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/woocommerce/woocommerce/labels{/name}","releases_url":"https://api.github.com/repos/woocommerce/woocommerce/releases{/id}","deployments_url":"https://api.github.com/repos/woocommerce/woocommerce/deployments","created_at":"2011-08-09T15:12:11Z","updated_at":"2018-07-26T09:57:30Z","pushed_at":"2018-07-26T10:58:53Z","git_url":"git://github.com/woocommerce/woocommerce.git","ssh_url":"git@github.com:woocommerce/woocommerce.git","clone_url":"https://github.com/woocommerce/woocommerce.git","svn_url":"https://github.com/woocommerce/woocommerce","homepage":"http://www.woocommerce.com/","size":148566,"stargazers_count":4591,"watchers_count":4591,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4332,"mirror_url":null,"archived":false,"open_issues_count":69,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":4332,"open_issues":69,"watchers":4591,"default_branch":"master"}},"base":{"label":"woocommerce:master","ref":"master","sha":"424956c6f642242e12928490e0f8a76154a05ca9","user":{"login":"woocommerce","id":473596,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/473596?v=4","gravatar_id":"","url":"https://api.github.com/users/woocommerce","html_url":"https://github.com/woocommerce","followers_url":"https://api.github.com/users/woocommerce/followers","following_url":"https://api.github.com/users/woocommerce/following{/other_user}","gists_url":"https://api.github.com/users/woocommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/woocommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woocommerce/subscriptions","organizations_url":"https://api.github.com/users/woocommerce/orgs","repos_url":"https://api.github.com/users/woocommerce/repos","events_url":"https://api.github.com/users/woocommerce/events{/privacy}","received_events_url":"https://api.github.com/users/woocommerce/received_events","type":"Organization","site_admin":false},"repo":{"id":2179920,"node_id":"MDEwOlJlcG9zaXRvcnkyMTc5OTIw","name":"woocommerce","full_name":"woocommerce/woocommerce","owner":{"login":"woocommerce","id":473596,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5Ng==","avatar_url":"https://avatars0.githubusercontent.com/u/473596?v=4","gravatar_id":"","url":"https://api.github.com/users/woocommerce","html_url":"https://github.com/woocommerce","followers_url":"https://api.github.com/users/woocommerce/followers","following_url":"https://api.github.com/users/woocommerce/following{/other_user}","gists_url":"https://api.github.com/users/woocommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/woocommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woocommerce/subscriptions","organizations_url":"https://api.github.com/users/woocommerce/orgs","repos_url":"https://api.github.com/users/woocommerce/repos","events_url":"https://api.github.com/users/woocommerce/events{/privacy}","received_events_url":"https://api.github.com/users/woocommerce/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/woocommerce/woocommerce","description":"An open source eCommerce plugin for WordPress.","fork":false,"url":"https://api.github.com/repos/woocommerce/woocommerce","forks_url":"https://api.github.com/repos/woocommerce/woocommerce/forks","keys_url":"https://api.github.com/repos/woocommerce/woocommerce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/woocommerce/woocommerce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/woocommerce/woocommerce/teams","hooks_url":"https://api.github.com/repos/woocommerce/woocommerce/hooks","issue_events_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/events{/number}","events_url":"https://api.github.com/repos/woocommerce/woocommerce/events","assignees_url":"https://api.github.com/repos/woocommerce/woocommerce/assignees{/user}","branches_url":"https://api.github.com/repos/woocommerce/woocommerce/branches{/branch}","tags_url":"https://api.github.com/repos/woocommerce/woocommerce/tags","blobs_url":"https://api.github.com/repos/woocommerce/woocommerce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/woocommerce/woocommerce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/woocommerce/woocommerce/git/refs{/sha}","trees_url":"https://api.github.com/repos/woocommerce/woocommerce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/woocommerce/woocommerce/statuses/{sha}","languages_url":"https://api.github.com/repos/woocommerce/woocommerce/languages","stargazers_url":"https://api.github.com/repos/woocommerce/woocommerce/stargazers","contributors_url":"https://api.github.com/repos/woocommerce/woocommerce/contributors","subscribers_url":"https://api.github.com/repos/woocommerce/woocommerce/subscribers","subscription_url":"https://api.github.com/repos/woocommerce/woocommerce/subscription","commits_url":"https://api.github.com/repos/woocommerce/woocommerce/commits{/sha}","git_commits_url":"https://api.github.com/repos/woocommerce/woocommerce/git/commits{/sha}","comments_url":"https://api.github.com/repos/woocommerce/woocommerce/comments{/number}","issue_comment_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/comments{/number}","contents_url":"https://api.github.com/repos/woocommerce/woocommerce/contents/{+path}","compare_url":"https://api.github.com/repos/woocommerce/woocommerce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/woocommerce/woocommerce/merges","archive_url":"https://api.github.com/repos/woocommerce/woocommerce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/woocommerce/woocommerce/downloads","issues_url":"https://api.github.com/repos/woocommerce/woocommerce/issues{/number}","pulls_url":"https://api.github.com/repos/woocommerce/woocommerce/pulls{/number}","milestones_url":"https://api.github.com/repos/woocommerce/woocommerce/milestones{/number}","notifications_url":"https://api.github.com/repos/woocommerce/woocommerce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/woocommerce/woocommerce/labels{/name}","releases_url":"https://api.github.com/repos/woocommerce/woocommerce/releases{/id}","deployments_url":"https://api.github.com/repos/woocommerce/woocommerce/deployments","created_at":"2011-08-09T15:12:11Z","updated_at":"2018-07-26T09:57:30Z","pushed_at":"2018-07-26T10:58:53Z","git_url":"git://github.com/woocommerce/woocommerce.git","ssh_url":"git@github.com:woocommerce/woocommerce.git","clone_url":"https://github.com/woocommerce/woocommerce.git","svn_url":"https://github.com/woocommerce/woocommerce","homepage":"http://www.woocommerce.com/","size":148566,"stargazers_count":4591,"watchers_count":4591,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4332,"mirror_url":null,"archived":false,"open_issues_count":69,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":4332,"open_issues":69,"watchers":4591,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/woocommerce/woocommerce/pulls/20905"},"html":{"href":"https://github.com/woocommerce/woocommerce/pull/20905"},"issue":{"href":"https://api.github.com/repos/woocommerce/woocommerce/issues/20905"},"comments":{"href":"https://api.github.com/repos/woocommerce/woocommerce/issues/20905/comments"},"review_comments":{"href":"https://api.github.com/repos/woocommerce/woocommerce/pulls/20905/comments"},"review_comment":{"href":"https://api.github.com/repos/woocommerce/woocommerce/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/woocommerce/woocommerce/pulls/20905/commits"},"statuses":{"href":"https://api.github.com/repos/woocommerce/woocommerce/statuses/4fc06834b6be29cc657b60ed35a9f17ee951b3dc"}},"author_association":"NONE"}}
{"actor":{"display_login":"gedex"}}