{"action":"created","issue":{"url":"https://api.github.com/repos/DevinVinson/WordPress-Plugin-Boilerplate/issues/331","labels_url":"https://api.github.com/repos/DevinVinson/WordPress-Plugin-Boilerplate/issues/331/labels{/name}","comments_url":"https://api.github.com/repos/DevinVinson/WordPress-Plugin-Boilerplate/issues/331/comments","events_url":"https://api.github.com/repos/DevinVinson/WordPress-Plugin-Boilerplate/issues/331/events","html_url":"https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/issues/331","id":106329135,"number":331,"title":"Correct way to add an admin notice?","user":{"login":"davetgreen","id":3214928,"avatar_url":"https://avatars.githubusercontent.com/u/3214928?v=3","gravatar_id":"","url":"https://api.github.com/users/davetgreen","html_url":"https://github.com/davetgreen","followers_url":"https://api.github.com/users/davetgreen/followers","following_url":"https://api.github.com/users/davetgreen/following{/other_user}","gists_url":"https://api.github.com/users/davetgreen/gists{/gist_id}","starred_url":"https://api.github.com/users/davetgreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davetgreen/subscriptions","organizations_url":"https://api.github.com/users/davetgreen/orgs","repos_url":"https://api.github.com/users/davetgreen/repos","events_url":"https://api.github.com/users/davetgreen/events{/privacy}","received_events_url":"https://api.github.com/users/davetgreen/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-14T12:20:09Z","updated_at":"2015-09-14T16:48:09Z","closed_at":"2015-09-14T16:48:09Z","body":"Hi @DevinVinson \r\n\r\nFirst of all, thank you so much for the work you've put into this. For a plugin development newbie such as myself it's really, really useful.\r\n\r\nI'd like to have a simple admin notice fire on plugin activation, but I'm not sure how to approach this within the boilerplate.\r\n\r\nI understand I'll need to add this to my constructor...\r\n\r\n`add_action( 'admin_notices', array( $this, 'activation_notice' ) );`\r\n\r\n...as well as adding the static function it calls...\r\n\r\n````\r\n\tpublic static function activation_notice() {\r\n\t    echo \"<div class='updated'><p>Notice to be shown</p></div>\";\r\n\t}\r\n````\r\nI've tried this in both the My_Plugin_Activator & My_Plugin_Admin classes, but I get an error along the lines of:\r\n\r\n`The plugin generated 451 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.`\r\n\r\nThe notice does appear when I add the above to the My_Plugin_Admin class, which is positive!\r\nThanks."},"comment":{"url":"https://api.github.com/repos/DevinVinson/WordPress-Plugin-Boilerplate/issues/comments/140141553","html_url":"https://github.com/DevinVinson/WordPress-Plugin-Boilerplate/issues/331#issuecomment-140141553","issue_url":"https://api.github.com/repos/DevinVinson/WordPress-Plugin-Boilerplate/issues/331","id":140141553,"user":{"login":"davetgreen","id":3214928,"avatar_url":"https://avatars.githubusercontent.com/u/3214928?v=3","gravatar_id":"","url":"https://api.github.com/users/davetgreen","html_url":"https://github.com/davetgreen","followers_url":"https://api.github.com/users/davetgreen/followers","following_url":"https://api.github.com/users/davetgreen/following{/other_user}","gists_url":"https://api.github.com/users/davetgreen/gists{/gist_id}","starred_url":"https://api.github.com/users/davetgreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davetgreen/subscriptions","organizations_url":"https://api.github.com/users/davetgreen/orgs","repos_url":"https://api.github.com/users/davetgreen/repos","events_url":"https://api.github.com/users/davetgreen/events{/privacy}","received_events_url":"https://api.github.com/users/davetgreen/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T16:48:09Z","updated_at":"2015-09-14T16:48:09Z","body":"@slushman , thank you **so** much for that! Crystal clear now and working as expected. Much obliged sir!\r\n\r\nOne quick follow up question if I may: should every action/filter call be made from the loader in My_Plugin_Class then?"}}