WordPress Widget for Ventrilo

I’ve recently developed a pretty flexible, basic, WordPress Widget for showing a Ventrilo server status. It’s written in PHP, is Object Orientated and uses XML style sheets (XSLT) to allow for easy customisation of the look and feel.

A while back I was setting up a Left4Dead Ventrilo server for a few friends, after I got it up and running, I went searching for a Widget that would let me add a server status to my home page. I just wanted to show is the server was up, who was currently connect and what channel they were in; I didn’t have much luck.

I decided to write one myself in PHP. I wanted it to be flexible enough to support multiple methods of retrieval but also allow to easy changing of the UI.

I went for a new Web Service utilising the PHP Ventrilo Status Script available from the Ventrilo site. It connects to the Ventrilo server and transforms the Object structure into XML. The widget itself connects to this service via Javascript, retrieves the XML, then applies an XSLT document and DOM injects the result asynchronously on page load. This gave a few advantages: –

  • It’s asynchronous and won’t affect the load time of the home page as the work is done after page load
  • Clear separate of logic between parsing the RCON command out of the server, the Widget code and the UI
  • Any information that a UI designer might want in styling the Widget is available in the XML, all they need to do is update the XSLT to hook into it

The widget currently supports: –

  • Direct interrogation of the Server – each page load the server is queried in real time to get the status (not suggested).
  • CRON interrogation – the server is interrogated from a CRON task, the result is stored in a cache XML file that’s served up locally.
  • Support for obtaining the status via: –
    • The official Ventrilo status binary file (doesn’t normally work on shared hosting due to permissions)
    • A HTTP request to the Ventrilo Spy tool (http://eetara.com/tools/ventrilospy)

I’m sure there’s better ways of implementing it so I’m open to suggestions but I’ve stopped playing at the moment, so lost interest in finishing off the plugin and making it pretty; if anyone wants the code I can hand it over.

Installation Instructions

  • Grab the latest version from github (git clone https://github.com/SoulRob/WP_Ventrilo)
  • Place the WP_Ventrilo folder inside the wp-content/plugins directory
  • Activate the plugin from the Plugins section of the WordPress Dashboard
  • Add the “Ventrilo Status Widget” from the Widgets page to the desired section of the page
  • Enter the host name and port of the server to display the status of
  • You’ll need to add the following scheduled CRON task on your hosting company, to avoid VentSpy from getting DDOSed. It will generate the XML for the status on a regular basis that the widget will use to render.
cd /path/to/wordpress/wp-content/plugins/WP_Ventrilo/service/cron/; php CronTaskVentSpy.php -h HOSTNAME -o 3784 >/dev/null 2>&1

Plugin is still in development with more options coming eventually. Feel free to tweak the ventrilo_status.xsl file to change how the widget renders.

9 comments on “WordPress Widget for Ventrilo

    • Also, I don’t think I put in a toggle between either a CRON based method or direct, I was still working on it when I stopped. At the moment it’s hard coded to pull the XML file from a local cache that would be created by executing the php file in “service/cron/CronTask.php”.

      You can switch it to direct mode by changing line 12 in service/Service.php to
      $impl = new VentriloServiceDirect();

      Alternativly you can just run CronTask.php from the command line passing the args -host {hostname} -port {port} -pass {pass}; that’ll generate the cache file with the XML details in it.

  1. im wondering what u did to start the Ventrilo widget apparently im having trouble with it –
    (just adding it to site?)

    • Hey there,

      If you’re using a shared hosting company I expect it’s a permissions problem. I was running it from a vanilla PHP install on a server I controlled.

      I’ll take a look to see if I can get it up and running on my hosting company that has very strict PHP settings and get back to you.

    • I was having a hard time getting the ventrilo binary executing on my shared hosting server. I’ve made some quick changes so that the widget now uses VentSpy to ping the status (instead of doing it all locally).

      Take a look at the latest master on GitHub, I’ve also updated the blog post with some basic installation instructions. You’ll still need to set up a CRON to stop VentSpy getting hammered every time someone hits your page. There’s probably a clever way of doing caching on a WordPress widget but not sure how atm.

Leave a Reply

Your email address will not be published. Required fields are marked *