{"action":"created","issue":{"url":"https://api.github.com/repos/one-signal/OneSignal-WordPress-Plugin/issues/12","repository_url":"https://api.github.com/repos/one-signal/OneSignal-WordPress-Plugin","labels_url":"https://api.github.com/repos/one-signal/OneSignal-WordPress-Plugin/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/one-signal/OneSignal-WordPress-Plugin/issues/12/comments","events_url":"https://api.github.com/repos/one-signal/OneSignal-WordPress-Plugin/issues/12/events","html_url":"https://github.com/one-signal/OneSignal-WordPress-Plugin/pull/12","id":134378289,"number":12,"title":"Add filter for included_segments to support notification segmentation","user":{"login":"henkler","id":10156666,"avatar_url":"https://avatars.githubusercontent.com/u/10156666?v=3","gravatar_id":"","url":"https://api.github.com/users/henkler","html_url":"https://github.com/henkler","followers_url":"https://api.github.com/users/henkler/followers","following_url":"https://api.github.com/users/henkler/following{/other_user}","gists_url":"https://api.github.com/users/henkler/gists{/gist_id}","starred_url":"https://api.github.com/users/henkler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henkler/subscriptions","organizations_url":"https://api.github.com/users/henkler/orgs","repos_url":"https://api.github.com/users/henkler/repos","events_url":"https://api.github.com/users/henkler/events{/privacy}","received_events_url":"https://api.github.com/users/henkler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-17T19:34:38Z","updated_at":"2016-02-18T17:40:44Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/one-signal/OneSignal-WordPress-Plugin/pulls/12","html_url":"https://github.com/one-signal/OneSignal-WordPress-Plugin/pull/12","diff_url":"https://github.com/one-signal/OneSignal-WordPress-Plugin/pull/12.diff","patch_url":"https://github.com/one-signal/OneSignal-WordPress-Plugin/pull/12.patch"},"body":"References issue #11 \r\n\r\nAdd a new wordpress filter called 'onesignal_send_notification_included_segments'.\r\n\r\nIf this filter is defined in the user's theme/plugin, it will allow the customization of the included_segments value to be whatever the theme returns.\r\n\r\nSample use case that segments notifications based on a post's team name:\r\n\r\n```php\r\nadd_filter('onesignal_send_notification_included_segments', 'mytheme_included_segments');\r\nfunction mytheme_included_segments($new_status, $old_status, $post) {\r\n  $included_segments = array('All');\r\n  $team = get_post_team_name($post->ID);\r\n  if (isset($team)) {\r\n    $included_segments = array($team);\r\n  }\r\n  return $included_segments;  \r\n}\r\n```\r\n\r\n<!-- Reviewable:start -->\r\n[<img src=\"https://reviewable.io/review_button.svg\" height=\"40\" alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/one-signal/onesignal-wordpress-plugin/12)\r\n<!-- Reviewable:end -->\r\n"},"comment":{"url":"https://api.github.com/repos/one-signal/OneSignal-WordPress-Plugin/issues/comments/185829175","html_url":"https://github.com/one-signal/OneSignal-WordPress-Plugin/pull/12#issuecomment-185829175","issue_url":"https://api.github.com/repos/one-signal/OneSignal-WordPress-Plugin/issues/12","id":185829175,"user":{"login":"henkler","id":10156666,"avatar_url":"https://avatars.githubusercontent.com/u/10156666?v=3","gravatar_id":"","url":"https://api.github.com/users/henkler","html_url":"https://github.com/henkler","followers_url":"https://api.github.com/users/henkler/followers","following_url":"https://api.github.com/users/henkler/following{/other_user}","gists_url":"https://api.github.com/users/henkler/gists{/gist_id}","starred_url":"https://api.github.com/users/henkler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henkler/subscriptions","organizations_url":"https://api.github.com/users/henkler/orgs","repos_url":"https://api.github.com/users/henkler/repos","events_url":"https://api.github.com/users/henkler/events{/privacy}","received_events_url":"https://api.github.com/users/henkler/received_events","type":"User","site_admin":false},"created_at":"2016-02-18T17:40:44Z","updated_at":"2016-02-18T17:40:44Z","body":"I've added this to the admin panel as well.  Now users can customize which segments posts go to by entering a comma delimited string in the plugin admin panel.  If left blank (default), it defaults to All."}}