Wednesday, 1 April 2009

Simple SVN WordPress Widget

After getting bored on working on my final year project I decided to take a look at creating widgets word my blog. There are SVN hooks on my repositories that store the commit details in a SQL database. I thought I would create a widget that would pull out the last message and display it.

Plugin Name: LastCommit
Plugin URI:
Description: Gets Last Commit Message
Author: John Tindell
Version: 1
Author URI:
function lastCommit_widget() {

$server = 'localhost';
$link = mssql_connect($server, 'username', '************');
echo '
  • ';
    echo "

    Last Commit

    mssql_select_db('svnyeti', $link);
    $query = mssql_query('select top 1 * from SVNLog order by liLogEntryPk desc', $link);
    $row = mssql_fetch_array($query);
    print '

    ' . $row['lszLogEntry'] . '

    echo '
  • ';
    function init_lastCommit(){
    register_sidebar_widget("LastCommit", "lastCommit_widget");
    add_action("plugins_loaded", "init_lastCommit");

    When I get more time I will develop this a bit more.

    1 comment:

    1. John,

      I would be easy to make the widget a bit more theme friendly by using my new tool over at

      If you get a chance to try it please let me know what you think.