{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/jetpack/issues/3122","labels_url":"https://api.github.com/repos/Automattic/jetpack/issues/3122/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/jetpack/issues/3122/comments","events_url":"https://api.github.com/repos/Automattic/jetpack/issues/3122/events","html_url":"https://github.com/Automattic/jetpack/issues/3122","id":121296855,"number":3122,"title":"Function/Filter to check Primary user?","user":{"login":"bhubbard","id":3837,"avatar_url":"https://avatars.githubusercontent.com/u/3837?v=3","gravatar_id":"","url":"https://api.github.com/users/bhubbard","html_url":"https://github.com/bhubbard","followers_url":"https://api.github.com/users/bhubbard/followers","following_url":"https://api.github.com/users/bhubbard/following{/other_user}","gists_url":"https://api.github.com/users/bhubbard/gists{/gist_id}","starred_url":"https://api.github.com/users/bhubbard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhubbard/subscriptions","organizations_url":"https://api.github.com/users/bhubbard/orgs","repos_url":"https://api.github.com/users/bhubbard/repos","events_url":"https://api.github.com/users/bhubbard/events{/privacy}","received_events_url":"https://api.github.com/users/bhubbard/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-09T17:23:32Z","updated_at":"2015-12-09T19:10:47Z","closed_at":"2015-12-09T19:10:47Z","body":"Hey guys,\r\n\r\nSo I wrote a function for a plugin we use on our client sites. The job is to present a notice in wp-admin to our team user if the jetpack primary user is not set to the client's user account. \r\n\r\nIf possible I would also like to make sure our team user account `imforza-dev` is always connected to our wordpress.com account. Any suggestions or help on how I can check the jetpack user connections?\r\n\r\n```php\r\n\r\n/**\r\n * Check if imforza-dev is the primary jetpack user. If so prompt imforza-dev to switch to client account.\r\n *\r\n */\r\nfunction imforza_jetpack_masteruser_check() {\r\n\r\n\t\tif ( username_exists( 'imforza-dev' ) ) {\r\n\r\n\t\t$imforza_user_id = username_exists( 'imforza-dev' );\r\n\r\n\t\t$jetpack_options = get_option('jetpack_options');\r\n\r\n\t\t$jetpack_master_id = $jetpack_options['master_user'];\r\n\r\n\t\t$current_user = wp_get_current_user();\r\n\r\n\t\tif ( $current_user->user_login == 'imforza-dev' && $imforza_user_id == $jetpack_master_id ) {\r\n\r\n\t   ?>\r\n    <div class=\"error\">\r\n        <p><?php _e( 'Currently <strong>imforza-dev</strong> is assigned as Jetpack\\'s <a href=\"https://jetpack.me/support/primary-user/\" target=\"_blank\">primary user</a>. Please use the <a href=\"admin.php?page=my_jetpack\">My Jetpack</a> page to set the <strong>client user</strong> as the primary user for Jetpack. The <strong>imforza-dev</strong> user should be connected to our WordPress account <strong>imforzadevelopers</strong>.', 'imforza-news' ); ?></p>\r\n    </div>\r\n    <?php\r\n\t    }\r\n\r\n\t}\r\n\r\n}\r\n\r\nadd_action('admin_notices', 'imforza_jetpack_masteruser_check');\r\n```"},"comment":{"url":"https://api.github.com/repos/Automattic/jetpack/issues/comments/163360529","html_url":"https://github.com/Automattic/jetpack/issues/3122#issuecomment-163360529","issue_url":"https://api.github.com/repos/Automattic/jetpack/issues/3122","id":163360529,"user":{"login":"bhubbard","id":3837,"avatar_url":"https://avatars.githubusercontent.com/u/3837?v=3","gravatar_id":"","url":"https://api.github.com/users/bhubbard","html_url":"https://github.com/bhubbard","followers_url":"https://api.github.com/users/bhubbard/followers","following_url":"https://api.github.com/users/bhubbard/following{/other_user}","gists_url":"https://api.github.com/users/bhubbard/gists{/gist_id}","starred_url":"https://api.github.com/users/bhubbard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhubbard/subscriptions","organizations_url":"https://api.github.com/users/bhubbard/orgs","repos_url":"https://api.github.com/users/bhubbard/repos","events_url":"https://api.github.com/users/bhubbard/events{/privacy}","received_events_url":"https://api.github.com/users/bhubbard/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T19:10:47Z","updated_at":"2015-12-09T19:10:47Z","body":"That should work for me, thanks!"}}