FlashingCursor does Drupal?? (and CiviCRM)


As most of my clients and partners know, FlashingCursor has always been about WordPress, but times … They are a changing.

Don’t get me wrong, I still LOVE me some WordPress!!  The fact is, however, that my client base has become much more diverse and WordPress is not a one-size-fits-all solution.  Sure, I’ve been able to overcome most of the areas where WordPress falls short with some custom code, a bit of magic and a shoehorn, but as client needs evolve it’s become an ever-increasing struggle to make WP work for everyone.

Enter: Drupal.  Yes, a very dirty word in many WordPress circles, Drupal is very complex and often misunderstood content management system.  It’s focus is not blogs or basic sites, in fact I’d hate to run a small business or personal site on Drupal — it’s far too complex for that.  Instead, I’d suggest Drupal for larger, more complicated, multi-user sites, custom membership sites, or as a solid base for web applications.

So – to make it official:  FlashingCursor is now officially offering Drupal 7, front-end and back-end, implementation and customization.

In addition to adding Drupal to our supported line-up, we’re now officially supporting CiviCRM – A web-based Contact Relationship Management (CRM) package that runs on the Drupal (and now WordPress) platforms.

Unlike most CRM packages which focus on managing commerce, CiviCRM focuses on the needs of non-profits; emphasizing communicating with individuals, community engagement, managing contributions, and administering memberships.

Interested in how FlashingCursor can help you with your Drupal or CiviCRM custom deveopment needs?  No problem – just contact me!


Add caching to your plugin


Sooner or later, we all write something that could make use of some caching.  I’ve seen several plugins store cache data using the options API — though this will work, it’s probably not the right place to do this.  Instead, you can easily use the WordPress transient API.  Unlike the options API, the Transients API gives you the option of an expiration.  Perfect for caching a query that needs updating, but doesn’t need run every time your code runs.  Here’s how it works:

function hwp_cached_query() {

	if ( false === ( $hwp_query_results = get_transient( 'hwp_query_results' ) ) ) {
		$hwp_query_results = new WP_Query( 'cat=5&order=random&tag=tech&post_meta_key=thumbnail' );
		set_transient( 'hwp_query_results', $hwp_query_results, 60*60*24 );
	}

	while ( $hwp_query_results->have_posts() ) : $hwp_query_results->the_post();
		echo '
<ul>
	<li>'; the_title(); echo '</li>
</ul>
';
	endwhile;

	// Reset Post Data
	wp_reset_postdata();

Quick breakdown:

	if ( false === ( $hwp_query_results = get_transient( 'hwp_query_results' ) ) ) {

Here we check to see if the transient entry exists.

		$hwp_query_results = new WP_Query( 'cat=5&order=random&tag=tech&post_meta_key=thumbnail' );
		set_transient( 'hwp_query_results', $hwp_query_results, 60*60*24 );

If our cached data doesn’t exist, we’ll run our query and cache it. In this case, we’re calling our cached entry ‘hwp_query_results’, using the $hwp_query_results variable, and setting the expiration for 24 hours.