You can add a new page using add_(sub)menu_page();
. WordPress is pretty kind in this case and offers tons of hooks, filters and higher level API functions that help you going around this.
Let’s just use add_users_page();
and hook into admin_menu
.
Example plugin
It adds an admin page that has the user_login
as slug.
Simply drop this into your plugins folder and give it a test to see if this is what you’re looking for.
<?php
! defined( 'ABSPATH' ) AND exit;
/* Plugin Name: (#66004) »kaiser« Add private User admin page */
// Add the admin page
function wpse66004_add_users_page()
{
global $current_user;
add_users_page(
// $page_title
'Your data'
// $menu_title
,'Private Page'
// $capability
,'read'
// $menu_slug
,$current_user->user_login
,'wpse66004_render_users_page'
);
}
add_action( 'admin_menu', 'wpse66004_add_users_page' );
// Render the users private admin page
function wpse66004_render_users_page()
{
global $current_user;
if ( ! current_user_can( 'read', $current_user->ID ) )
return;
echo "<h1>Hello World!</h1><p>And, of course, hello {$current_user->display_name} too!</p>";
}