The aim is for a proposed site to have customers be able to login and be able to view a private and customer specific ADMIN page NOT frontend page (although this would be much easier to achieve).
Said page would display user meta and content that the site Admin could add ad hoc.
I am confident in being able to create the menu item, page and populate with user meta, my understanding seems to fail when it comes to actually making said ADMIN page private on a customer by customer basis, and the bet way to add content to these pages by the admin.
Any pointers so I can get a better understanding, or indeed plugins that in part have these capabilities would be greatly appreciated.
Thanks
John
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>";
}