I'm creating a plugin with an admin page that needs to:
- stream a file for download (set content-type & other headers)
- display HTML without the admin menu etc
In both of these cases the 'pages' must be accessible only to logged in administrators. So far I've found one way to accomplish both of these, by including wp-blog-header.php in a php file, checking the user is an admin and doing things myself from then on, as below.
require('../../../wp-blog-header.php');
if (!current_user_can('administrator'))
{
wp_die( __('You do not have sufficient permissions to access this page.') );
}
...set headers & stream file
Is there a better way of doing this?
Is there any reason I shouldn't do it this way?
Thanks :)