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:

Screenshot: Todo List displays in Dashboard

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">'.
       __('&raquo;').'</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 &raquo;').'</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.

6 Responses to “Todo List Plugin: Patch to display todo in Dashboard”

  1. WordPress Plugins Database » Plugin Details » Todo List Plugin Says:

    [...] Visit [...]

  2. film izle Says:

    very good job really man ! film izle | sinema izle Regards

  3. babykläder Says:

    Very good post. thanks for the informative post. I appriciate for your effort.
    Keep poting more.
    Regards

  4. rap dinle Says:

    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.

  5. Titan Poker Bonus Code Says:

    Thanks for the great code.

    This saved alot of time for me.

  6. UK battery Says:

    Thank you for sharing!

Leave a Reply