Todo List Plugin: Patch to display todo in Dashboard
Abstract Dimension has written an excellent Todo List plugin for each author to manage a personal todo list.
After using it, I thought it would be nice to have my todo appeared on the Dashboard Latest Activity box as the screenshot below:
So, here’s a patch that does the job. To apply, simply copy and append the code below to the end of the plugin script, admin_todo.php.
The only thing the patch does is to retrieve the first ten todo items (sorted by priority) and display them on the Dashboard. No changes to database, it’s pretty safe to patch.
Welcome to submit bug reports through comments.
The patch source code, tested on Todo List Plugin version 1.2 :
/*
Patch-To : Todo List Plugin version 1.2
Description : To display the first 10 todo items sorted by priority on Dashboard.
Installation: Append the entire code to the end of admin_todo.php file.
Author : Wordpress By Examples
Author URL : http://wordpress.byexamples.com
License : GPL Version 2
*/
/*
List top 10 todo in Dashboard Lastest Activity
*/
function atd_todo_in_activity_box() {
global $table_prefix, $wpdb, $userdata;
get_currentuserinfo();
$table_name = $table_prefix . 'todolist';
echo '<div><h3>'.__('Todo List').
' <a href="edit.php?page=admin_todo.php">'.
__('»').'</a></h3>';
$sql = "SELECT id, todotext FROM $table_name ".
"WHERE status = 0 AND author = $userdata->ID ".
'ORDER BY priority LIMIT 10';
$results = $wpdb->get_results($sql);
if ($results) {
echo '<ol>';
foreach ($results as $result) {
echo "<li>$result->todotext <small>".
'(<a href="edit.php?page=admin_todo.php&action=edittd&id='.
$result->id . '&noheader&message=3">'.
__('Edit') . '</a>)</small></li>';
}
echo '</ol>';
}
else {
echo '<p>'.__('nothing to do...').'</p>';
}
echo '<p style="text-align:right">'.
'<a href="edit.php?page=admin_todo.php#addtd">'.
__('New Todo »').'</a></p></div>';
}
/*
Wordpress hooks
*/
if (function_exists('add_action')) {
add_action('activity_box_end', 'atd_todo_in_activity_box');
}
No tags for this post.

September 11th, 2007 at 3:44 pm
[...] Visit [...]
January 11th, 2009 at 8:08 am
very good job really man ! film izle | sinema izle Regards
February 24th, 2009 at 11:19 pm
Very good post. thanks for the informative post. I appriciate for your effort.
Keep poting more.
Regards
March 29th, 2009 at 10:40 pm
Obesity has many defects, it not only can lead to individuals, such as high blood pressure, heart disease, diabetes, arthritis and other diseases, but also the additional burden on public health has become social problems.
April 21st, 2009 at 3:35 am
Thanks for the great code.
This saved alot of time for me.
April 30th, 2009 at 11:22 am
Thank you for sharing!