Tag Archives: plugin

Harvest Reports WordPress Plugin

When freelancing I use the Harvest application to manage all of my time tracking. It has made invoicing painless, and while I got it thinking I was over-charging my clients, it turns out then I was not charging them enough! Anyway, after being listed as a WordPress consultant by Automattic I naturally had more WordPress contracts. I then wanted to solve a business need by allowing my clients to view their impending charges inside the familiar WordPress administration interface.

Harvest Reports PluginThis was impossible until recently when Harvest published their full API. I now have the ability, through REST, to retrieve my data via XML, parse it, and put it where I choose. This lead me to creating a WordPress plugin to accomplish this, and I was encouraged by someone at Harvest to make it public domain. So I present to you the “Harvest Reports WordPress Plugin.” See the screenshot on the right for what will be accomplished with the plugin.

Remember that this was made to solve a specific business need, namely the display of pending costs incurred since the last invoice. This is not meant to be an exhaustive representation of their API as it only uses a slice of it.

Requirements

  1. WordPress 2.3+
  2. A Harvest Account
  3. PHP5

You might wonder why you need PHP5 as WordPress only needs PHP4. I use the PHP5 SimpleXML functionality to parse the XML. This is far easier then trying to do it in PHP4. Most hosts do offer PHP5, but you might have to add the following to your .htaccess file to utilize that edition.

AddHandler application/x-httpd-php5 .php

Installation

  1. Download the plugin
  2. In WordPress 2.3 — 2.5 go to “Options” — “Harvest Reports”, and in 2.5 go to “Settings” — “Harvest Reports”.
  3. Enter your information
  4. Hit “Save”
  5. Go to “Manage” — “Your Chosen Title” to see the report

To get your project ID go to your Harvest dashboard — “Manage”, and you’ll see your projects listed. When you open up one you’ll see a numerical value in the URL bar (e.g. yourname.harvestapp.com /projects/49691/). The value you want is 49691. Remember this is only meant for one project, as that was the business need I needed it to solve. Also, if you want to limit the end date on the report I have included that, but leave it blank to retrieve data up to the second.

Caveat On Hourly Rates

Since this plugin is intended to ultimately provide a monetary figure I wanted it to get the default hourly rate from the API. Unfortunately, when I first parsed the XML I saw that despite the fact that my tasks use my default hourly rate nothing was in the XML returned. I pinged their support and got the following rationale.

When you read the Task API, you basically get back “No setting” at the second (task) level. We use the rates for reporting (and invoicing coming soon), here the defaults get cascaded. But for the API no cascading takes place to make it evident from where the value comes.”

What this means is that for every task that is used for the project you have to go in and manually set the hourly rate. Not ideal, and to me it’s not expected behavior (especially since the reporting tool inside the Harvest interface automatically uses that value), but once you set it you can forget it.

Upcoming Features

Even though I’ve worked a lot on this and need a break I still have improvements in mind.

  • JavaScript date picker
  • Exception handling from the API
  • Ajax retrieval of projects inside the options page (no need to insert a project ID manually)

I also need to double check that is handles tasks that aren’t billable by default correctly. Since I only track tasks that are billable I didn’t test this, but maybe someone can verify for me.

Props

I want to say thanks to Danny Wen of Harvest for encouraging me to do this, and Andrew Charlton of Geekly Weekly for pointing me in the way of cURL and SimpleXML.

WordPress Plugins for Writers

wordpress-crushed Wait, aren’t all WordPress users writers? Well, not exactly. A lot of people use the WordPress platform to talk about their pets, family, or odd Star Trek fetish (which is fine); but there are users of WordPress who subject themselves the rigors of professional writing. This post really is for those wanting to improve their blog’s typography.

When I started my first blog I found that the more serious I took it and the more involved my posts got that I needed more functionality. I wanted my blog to look and act less like a blog and more like an online print journal. It was this desire that started my look for WordPress plugins that could address the desires I had, and these are the best.

WP-Footnotes

The first thing I needed was a way to cite sources and make additional commentary in my writings, and footnotes are the perfect way to do that (even though they technically are endnotes, but the plugin does paginate). WP-Footnotes is an incredible plugin to accomplish this effectively. It has a lot of options, and it’s incredibly easy to use. You simply choose what the marking for the footnoted is (by default it’s double parenthesis), and when your post is rendered to the client it creates all the links for you.

A recent version has a smooth scrolling option that I do not like however. I instead plugged in another smooth scrolling script, and it turned out much better.

JavaScript Pull-Quotes

One of the things I like most about print publications are attractive pull-quotes, and with the JavaScript Pull-Quotes plugin you can achieve nice pull-quotes. It also has many options including different styles to choose for quote. You can even have it automatically cycle between quoting to the left and right! This is the best way to improve an article aesthetically.

Table of Contents Generator

One of the things I enjoy about Wikipedia is how it can give you a quick glance at the article’s content through a table of contents. Generating this functionality in your WordPress posts happen through the Table of Contents Generator WordPress Plugin.

It has no need to use special markup like the ones above, because it automatically scans the headings in the posts and creates a table of contents. The plugin will also recognize top-level and sub-headings. It is a great reminder to use headings in your posts which drastically improves the semantic value of your content.

In Series WordPress Plugin

Often times when writing about a topic in-depth it’s advisable to break it up for the reader. The way to do this before would be to create a page announcing the series and provide links to all the articles in the series. Well no more! The In Series WordPress Plugin makes this task seamless. The plugin adds an option to add it to a series, and the plugin generates the necessary connections between the content. It’s great, because it requires no hacking of your template–it works right out of the box!

Even though I personally haven’t got to give this plugin a go, I’m excited to really make use of this one. Writing series is a great way to present lengthy content on the web, and this plugin takes all of the work out of doing so (besides the writing of course).

WP-Typogrify

The last deals specifically with improving all the little things in typography that we traditionally miss but make a difference. This is a port from the original Python script for WordPress, and it carries the name WP-Typogrify. This does things such as inserting inline styles to adjust the CSS around all-caps, ampersands, and does important little things such as turning double hyphens into em-dashes and much more.

WP-Debug

WP-Debug Screenshot

WP-Debug Screenshot

WebDevStudio has created WP-Devel which uses the foundation of WP-Debug and has added enhancements. I’m no longer updating WP-Debug but instead pointing to their work.

I was using my StumbleUpon, and I came across Krumo which is a PHP debugging application. It allows you to see the content of server variables, cookies, and a lot more including specified variables such as $wp_query! After a short while I had a running WordPress plugin which should be an asset for WordPress developers.

Installation

  1. Download, upload, activate.

That’s it! As long as you’re logged in you’ll see the expandable menus in the footer of your page (nothing is shown to your visitors). It does rely on having the wp_footer() call in your theme so ensure that’s there if you don’t see anything.

Configuration

Krumo comes with some default styles: default, blue, green, orange, and scablon.com. It is set to default which works the best with the default WordPress theme. If you would like to change it you can go to the “krumo” folder of the plugin and edit the “selected” value in the krumo.ini file (you might have to adjust the styles depending on how CSS inheritance from your theme throws things off).

[skin]
selected = "default"

I have most of the Krumo API in the plugin, but you can add/remove at your lesiure. If you want to check a variable then simply add to lines 14, but you can see on line 14 that I had to declare WordPress variables as global, because the content is outside the loop. Simply add a global variable to line 12 if needed.

global $user_ID, $wp_query, $wp;
if ( $user_ID ) {
include ('krumo/class.krumo.php');

Be sure to check the documentation for their API if need be.