load_interface('header');
$can_edit_posts = current_user_can('edit_posts');
$can_edit_pages = current_user_can('edit_pages');
$can_edit_categories = current_user_can('manage_categories');
$can_edit_users = current_user_can('edit_users');
$valid_scroll = array(
'writemenu',
'managemenu',
'usersmenu',
'activitymenu'
);
if ( TRUE == $profileupdated )
$goto = 'usersmenu';
else
$goto = $_GET['goto'];
if ( ! in_array($goto, $valid_scroll) )
$goto = 'adminmenu';
/**
* DASHBOARD MENU
*/
echo '
' . __('Admin Options', 'wphone') . "
\n";
echo '\n";
/**
* WRITE MENU
*/
if ( $can_edit_posts || $can_edit_pages ) {
echo '' . __('Write') . "
\n";
echo '\n";
}
/**
* MANAGE MENU
*/
if ( $can_edit_posts || $can_edit_pages || $can_edit_categories) {
echo '' . __('Manage') . "
\n";
echo '\n";
}
/**
* USER MENU
*/
if ( $can_edit_users ) {
echo '' . __('Users') . "
\n";
echo '\n";
}
/**
* LATEST ACTIVITY MENU
*/
echo '' . __('Latest Activity') . "
\n";
echo '\n\n";
}
$numitems = 6; // Items to list below PLUS ONE
# Latest comments, adapted from /wp-admin/index.php
if ( $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date DESC LIMIT $numitems") ) {
echo '' . __('Latest Comments', 'wphone');
if ( !$this->iscompat)
echo "\n\n";
$count = 0;
foreach ( $comments as $comment ) {
$count++; if ( $count >= $numitems ) break;
echo '';
if ( current_user_can('moderate_comments') )
echo '';
else
echo 'htmltarget( '_blank', TRUE ) . '>';
echo sprintf( __('%1$s on %2$s'), strip_tags($comment->comment_author), get_the_title($comment->comment_post_ID) );
echo "\n";
}
if ( count($comments) == $numitems && current_user_can('moderate_comments') )
echo '' . __('More »') . "\n";
if ( !$this->iscompat )
echo "\n\n";
}
# Recent posts
if ( function_exists('get_private_posts_cap_sql') )
$recentpostssql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " AND post_date_gmt < '" . current_time('mysql', 1) . "' ORDER BY post_date DESC LIMIT $numitems";
else
$recentpostssql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND post_date_gmt < '" . current_time('mysql', 1) . "' ORDER BY post_date DESC LIMIT $numitems";
if ( $recentposts = $wpdb->get_results($recentpostssql) ) {
echo '' . __('Recent Posts', 'wphone');
if ( !$this->iscompat )
echo "\n\n";
$count = 0;
foreach ( $recentposts as $post ) {
$count++; if ( $count >= $numitems ) break;
if ( $post->post_title == '' ) $post->post_title = sprintf(__('Post #%s'), $post->ID);
echo '' . $post->post_title . "\n";
}
if ( count($recentposts) == $numitems && ( $can_edit_posts || $can_edit_pages || $can_edit_categories ) )
echo '' . __('More »') . "\n";
if ( !$this->iscompat )
echo "\n\n";
}
# Scheduled posts
if ( $can_edit_posts ) {
if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date ASC LIMIT $numitems") ) {
echo ''.__('Scheduled Entries', 'wphone');
if ( !$this->iscompat )
echo "\n\n";
$count = 0;
foreach ( $scheduled as $post ) {
$count++; if ( $count >= $numitems ) break;
if ( $post->post_title == '' ) $post->post_title = sprintf(__('Post #%s'), $post->ID);
echo '';
echo sprintf(__('%1$s in %2$s'), '"' . $post->post_title . '"', human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') ));
echo "\n";
}
echo '' . __('More »') . "\n";
if ( !$this->iscompat )
echo "\n\n";
}
}
// Lets plugin developers add modules to the Latest Activity screen
do_action( 'wphone_activity' );
echo "\n";
/**
* PLUGIN MENUS
*/
// If you want to add new non-AJAX pages (such as the ones listed above), this is the hook to use
do_action( 'wphone_dashboard' );
$this->load_interface('footer');
?>