I managed to replace the dashboard with my customised version by tweaking the code of the ‘dasher’ plugin.
// this intercepts the request for the real Dashboard
if(strstr($_SERVER['PHP_SELF'], 'wp-admin/index.php') !== FALSE) {
$is_admin = TRUE;
if(!isset($_GET['page'])) {
add_action('admin_head', 'dbmod_user_dash_load', 99999);
}
}
// This function contains the replacement Dashboard. Some of the globals aren't needed anymore, but I'm not sure which ones...
function dbmod_user_dash_load() {
global $confidential_cat, $baseURL, $dasher_options, $wpdb, $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $user_nickname, $menu, $submenu, $admin_page_hooks, $parent_file, $title, $plugin_page, $submenu_file, $menu_hook, $pagenow, $wp_version;
get_currentuserinfo(); if ($user_level < 8) {
require_once(ABSPATH . '/wp-admin/admin.php');
$title = __('Dashboard');
require_once(ABSPATH . '/wp-admin/admin-header.php');
require_once (ABSPATH . WPINC . '/rss-functions.php');
echo '
</head>
<body>
<div id="wphead">
<h1>' . wptexturize(get_settings(('blogname'))) . ' <span>(<a href="' . get_settings('home') . '/">' . __('View site') . " ?</a>)</span></h1>n</div>n";
if ($wp_version{0} != '1') { // suppress the user info thing for WP 1.x
echo "<div id='user_info'>";
printf(__('Howdy, <strong>%s</strong>.'), $user_identity);
echo ' [<a href="' . get_settings('siteurl') . '/wp-login.php?action=logout" title="' . __('Log out of this account') . '">' . __('Sign Out') . '</a>, <a href="profile.php">' . __('My Account') . "</a>] </div>n";
}
require(ABSPATH . '/wp-admin/menu-header.php');
//Here is the new content of the dashboard
echo '<div class="wrap">' . "n<h2>" . __('Dashboard') . "</h2>"
?>
<h3>YOUR TITLE</h3>
blah blah blah
<?php
require_once(ABSPATH . '/wp-admin/admin-footer.php');
die(); // critical - stops execution so the real Dashboard doesn't happen
}
}
You can add whatever you want in the middle; you can change the h2 dashboard title also, or make calls to queries.
Of course I suggest you using the wp divs to mimic the appearence of the real dashboard; to see them, just look at the code of admin pages.
This worked like magic for me.
Cheers,
Davide