Activating BuddyPress for PHPUnit WordPress-tests

I have found myself writing PHPUnit tests for WordPress plugins lately (using wordpress-tests) and the code that I’m working with has a dependency on BuddyPress.  Enabling BuddyPress for WordPress unit testing requires a bit of hoop jumping because you can’t use the wp_tests_options global variable as you would any other plugin in your local bootstrap file (which is configured in phpunit.xml):

$GLOBALS['wp_tests_options'] = array(
  'active_plugins' => array(
    'wp-debug-robot/wp-debug-robot.php'
  ),
);

Instead, run the following within your bootstrap file after you’ve included the wordpress-tests bootstrap:

  // activate the buddypress plugin for your network (if you aren't running MULTISITE, the third parameter should be FALSE)
  activate_plugin( WP_CONTENT_DIR . '/plugins/buddypress/bp-loader.php', '', TRUE, TRUE );

  // set the components that you want to activate
  $active_components = array(
    'activity' => TRUE,
    'friends' => FALSE,
    'groups' => FALSE,
    'messages' => TRUE,
    'xprofile' => TRUE,
    'blogs' => TRUE,
  );

  // update your site's bp-active-components option with your configured settings
  update_option( 'bp-active-components', $active_components );

  // include the file that contains the logic you need to create BuddyPress tables
  require_once WP_CONTENT_DIR . '/plugins/buddypress/bp-core/admin/bp-core-schema.php';

  // run the installer
  bp_core_install();

With that in place, your tests should have BuddyPress classes & functions available to you – complete with BP tables in your database!

Plugin: Sexy Comments v1.4 Released!

[[innerindex]]

Introduction

This has been a long time coming and I am happy to announce the release of Sexy Comments v1.4! With this version comes a lot of changes…so be sure to read the installation section! Along with simple optimizations and general restructure, the following features are now available:

Feature List

  • Ajax comment preview (new feature)
  • Author post highlighting
  • Avatars
    • Either display/hide avatars
    • Select your avatar service of choice (Gravatar and MyBlogLog options are available)
    • Specify maximum avatar dimension (Gravatar Only)
    • Customize default/trackback avatars
  • Comment Reply-To (new feature)
  • Comment Themes (new feature)
  • CSS overriding
  • “Number of Comments” message customization
  • jQuery inclusion toggling

Installation & Upgrading

  1. Download Sexy Comments v1.4 from the WordPress plugin directory
  2. Unzip that little sucker
  3. Place sexy-comments folder in your wp-content/plugins directory (it should look like this: wp-content/plugins/sexy-comments/
  4. Log in to your WordPress plugin admin page and activate the plugin.
  5. In the plugin admin page, click the SexyComments sub-menu.
  6. Customize the settings until you have something that works for you.
  7. Locate your theme’s template file that displays comments (typically comments.php). Remove the comment output loop and replace with:
    < ?php sexycomments::show($comments); ?>
    
  8. If you plan to use the Ajax features or the Reply-To features, you will need to do two things.
    1. Enable jQuery and jQuery Form Extension via the Plugin > SexyComments administration page.
    2. Locate the template file that contains the comment submission form (typically comments.php near the bottom) and replace that chunk of code with:
      < ?php sexycomments::form(); ?>
      

    NOTE: Be sure not to touch the section that generates the form for adding comments! This plugin does not re-create the comment creation form.

  9. Lastly, consider disabling the plugin CSS and taking the example CSS provided and customize it to suit your theme’s color scheme.
  10. You should be all set, now! w00t w00t! Go make a MyBlogLog or Gravatar account if you don’t already have one and upload an avatar. Gravatar tends to be pretty flakey so I’d suggest using MyBlogLog.

FAQs

  • Q: What is this “comment loop” you speak of?

    A: Ah, yes. That thing. Well, its anatomy looks similar to this (there will be some variation from theme to theme):

    < ?php if ($comments) : ?>
    	<!-- some HTML is typically here -->
    
    	< ?php foreach ($comments as $comment) : ?>
            <!-- the output HTML of each individual comment -->
    
    	< ?php endforeach; /* end for each comment */ ?>
    	<!--...more HTML -->
     < ?php else : // this is displayed if there are no comments so far ?>
    	< ?php if ('open' == $post->comment_status) : ?>
    		<!-- typically a blank area or a place with a comment -->
    	 < ?php else : // comments are closed ?>
    		<!-- closed comments section -->
    	< ?php endif; ?>
    < ?php endif; ?>
    
    
  • Q: Ok…so I just upgraded to a new version and there is nothing in the SexyComments admin page…WTF?

    A: Yeah. Sorry about that. In this version, the directory structure has changed drastically and Sexy Comments should no longer live in wp-content/plugins/sexycomments.php OR wp-content/plugins/sexycomments/sexycomments.php, but instead it should be in wp-content/plugins/sexy-comments/. Make sure that the plugin is in the correct location of your plugins directory.

  • Q: What happened to sexycomments_print($comments)? I used to use that to get my comments to display…will it still work?

    A: Along with a directory structure overhaul, this version had a large code overhaul as well. The old function (sexycomments_print) is deprecated but will still work for the time being. I greatly urge you to move over to the new function call sexycomments::show($comments) as that is the new *impoved* function.

WordCamp 2007: Day 1: Blogs vs. Journalism

Speakers: John C. Dvorak and Om Malik

This discussion touches on the similarity and differences of blogging and journalism. The talk spread over a number of topics, touching on: journalism’s view on blogging; comment moderation; libel suits and how to avoid them; layouts and perception. Overall, a great session.

Some interesting nuggets that the speakers have left with us (paraphrased when I couldn’t keep up) are as follows:

“Blogging is more of a reflection of our times.” -Malik

“[Blogging creates an independent force that causes other media to be affected.]” -Dvorak

“[Bloggers are susceptible as much as mainstream media to trivial things like the loss of Paris Hilton's PDA]” -Dvorak

“Bloggers present themselves as bloggers. This has to change [if you want to be credible.]” -Dvorak

“Institutionalized ankle biting…essentially ridiculing mainstream media by their incompetence [...] which is driving the mainstream media nuts.” -Dvorak

“The blogging world will be rejected out of hand by mainstream media as they are annoyances.” -Dvorak

“Blogging has a special aspect[, comments. ... Respect the comments, good and bad. Read them. Respond to them.]” -Malik

“Comments make many blogs.” -Dvorak

“Collected intelligence is the biggest difference and benefit of blogging. You have to read every comment and respond appropriately.” -Malik

“Moderate comments. [...] Moderating is the key to success, really.” -Dvorak

“It is the writer’s job to read the comments and moderate them.” -Dvorak

“‘You Suck and here’s why.’ comments are ok…” -Dvorak

On permanence of articles: “If I write an article and someone finds an error…I fix it.” -Dvorak

“When you write a post, write it. Then step away for 15 minutes. Then come back. [Problems are found much easier.]” -Malik

“Read your post outloud before you post. You’ll find stupid errors.” -Dvorak

“[Neo blog layouts, even though it is a blog, gains credibility through an advanced design.] First impressions are everything.” -Dvorak (see: XXLMag.com)

“Use ‘douchebag’ to cut down people…not crook to let people know that someone is shady.” -Dvorak

WordCamp 2007: Day 1: Podcasting

Speaker: Dan Kuykendall of MightySeek.com.

Dan. Podcaster. Developer. The session? Primarily an introduction to the excellent podPress WordPress plugin that started as a simple podcasting-geared tool and has morphed into a full featured media management plugin. As I haven’t dived into the wonderful world of podcasting, the plugin looks pretty sexy. The statistics provided by podPress seems quite extensive.

In addition to promoting the plugin, Dan briefly details the process of how he creates his podcasts and the equipment he uses. Pretty snazzy. Of particular note is his method for reducing room echo…building a foam crate where he places his microphone. Pretty snazzy.

Off To WordCamp

I'm going to WordCamp I’m heading off to WordCamp – a WordPress blogging conference – with Zach tomorrow (Friday). This will be my first WordCamp conference as well as my first time flying with JetBlue so I’m pretty excited all the way around. Once in San Francisco, we’ll be hooking up with Casey, a veteran camper who has conveniently scoped out accommodations, transportation, and all that fun stuff.

To top it all off…I hope to be getting a free T-Shirt :)

WordPress Plugin: Sexy Comments

Unhappy with my theme’s comment display, I recently re-coded a sexier comment display as a plugin so others can sexify their comments as well.

Download the plugin.

Features

  • Forum-thread-like comment layout: User information to the left, comment to the right.
  • Author post highlighting
  • Altered Trackback/Pingback Display Formating
  • Avatars
    • Either display/hide avatars
    • Select your avatar service of choice (Gravatar is the only option until I find more avatar services)
    • Specify maximum avatar dimension
    • Customize default/trackback avatars
  • “Number of Comments” Message Customization
  • CSS Overriding

Installation

  1. Download and unzip the sexycomments.zip
  2. Place sexycomments folder in your wp-content/plugins directory
  3. Log in to your WordPress admin panel and activate the plugin, then visit the SexyComments submenu of the plugins tab.
  4. Customize the settings until you have something that works for you.
  5. Locate the template file(s) in your theme that loops over and displays comments. Remove that comment output loop and replace with:
    < ?php sexycomments_print($comments); ?>  
    

    NOTE: Be sure not to touch the section that generates the form for adding comments! This plugin does not re-create the comment creation form.

  6. Lastly, consider disabling the plugin CSS and taking the example CSS provided and customize it to suit your theme’s color scheme.
  7. You should be all set, now! w00t w00t! Go make a Gravatar account if you don’t already have one and upload an avatar.

MyComic WordPress Plugin v0.5 Released!

Last night I went into plugin fixing mode and have updated and released the latest version of the MyComic WordPress Plugin (download it here)! This new version is compatible with the latest version of WordPress (2.1.2) and it fixes/adds/changes a few things:

Bug Fixes:

  • Error on plugin activation is fixed
  • Fixed some inefficiencies with the comic nav display code
  • Fixed some incompatibility errors with the new version of WordPress
  • Correctly linked to the example MyComic CSS file

New Features/Updates:

  • MyComic options menu has been relocated from the WordPress Options Tab to the WordPress Plugins Tab
  • Users can choose to sort comic navigation by post_id or by comic id

Special thanks to all the people that left comments to poke/prod me to update the plugin. Thanks to Mosey for being my Beta Testing Guinea Pig.

MasterWish WordPress Plugin v1.5 Released!

MasterWish is happy to announce that there is a new version of the MasterWish WordPress Plugin available for download! Get it here.

Bug Fixes:

  • Images now display in lists
  • Currency symbols now match what the list owner chooses in MasterWish

New Features/General Updates:

  • Works in WordPress v2.1.2
  • Plugin now uses MasterWish List XML rather than the List RSS to separate out elements (like Description, Price, Priority, etc) rather than piling them all in the RSS Description tag.
  • MasterWish options menu has be relocated from the WordPress Options menu to the WordPress Plugins menu to allow for easier use for those without full Admin (i.e. in WordPress Mu)
  • www.masterwish.com URL has been updated to masterwish.com

New Version Of Bsuite…w00t!

I was thrilled when Casey over at MaisonBisson posted about the release of Bsuite b2v6. After much prodding by me, Casey has separated tags from posts into their own tables. He and I sat down one evening and fleshed out the overall goal for the tagging structure…we butted heads on a few things but the end result is pretty snazzy. I’ve beta tested the tagging features and I’m fond of them…w00t! Because of all the optimizations, I quickly installed the update on the blogs I host:

Zach writes (and I agree with him hands down):

This is a fantastic plugin for WordPress which does a lot of heavy lifting and can help to better leverage the long tail of your content. Frankly I wouldn’t run WordPress without it. This bug fix release clears up a lot of little nagging problems [...]

Syntax Highlighting in WordPress

Some of my most recent posts involving code have displayed the wonderful blocks of login in all its syntax highlighted glory. A week ago I stumbled on the sweet syntax highlighting plugin – iG:Syntax Highligher (here’s the link to the actual plugin).

The highlighter uses GeSHi for the highlighting engine then wraps a bunch of sweet javascript functions around it to give it a bunch of features (i.e. viewing as syntax highlighted code or plain text toggle). Here’s the supported language list:

[as] & [/as]
[asp] & [/asp]
1
1
1
1
1
1
1
1
[mysql] & [/mysql]
1
1
1
1
[smarty] & [/smarty]
1
1
1
1

Installation is super easy and simply requires you to edit the quicktags.js file in wp-admin. If you’re looking for a syntax highlighter for your blog, I’d suggest you give this one a try. w00t.

MasterWish WordPress Plugin

I am pleased to announce the arrival of the MasterWish WordPress plugin! Anyone that has an account on MasterWish and runs a WordPress blog can aggregate their publicly viewable lists. For an example of how I have it set up, check here.

Get the MasterWish WordPress plugin v1.1!

Setup Instructions:
Installing the Plugin:

1. Download and unzip wp-masterwish.zip

2. Place masterwish.php in your wp-content/plugins directory
3. Log in to your WordPress admin panel and activate the plugin, then visit the MasterWish submenu of the options tab.
4. Enter your MasterWish username and click ‘Update Options’
5. If you want a default list to be selected, select a list from the List drop-down menu and click ‘Update Options.’
6. Create a new Template for your wishlist in your wp-content/themes directory.

In the body section of that template, we suggest you place the following function calls:

<h2><a href=”<?php masterwish_list_url($_GET['list_id']); ?>”><?php masterwish_list_title($_GET['list_id']); ?></a></h2>
<strong>My Lists</strong>: <?php masterwish_lists(”,’[','] ‘); ?><br/><br/>
<?php masterwish_get_list(); ?>

7. Create a new Page in WordPress and set its template to the template you just created in the previous step!

MasterWish Plugin Functions:

  • masterwish_get_list

    retrieves items from a list

    Usage:

    masterwish_get_list({list_id},{display_images},{maxresults},{random});

    list_id is the wishlist id number that is being browsed. Leaving this with a blank string ” pulls the default list set in the MasterWish Plugin’s options tab.
    display_images specifies whether the item images are displayed. Default is false. Available options: (true/false).
    maxresults is the maximum number of items you want displayed in a given list. Setting this value to 0 displays all items in a list.
    random shuffles your item list around.

  • masterwish_list_title

    retrieves the current list title

    Usage:

    masterwish_list_title({list_id},{return},{before},{after});

    list_id is the wishlist id number that is being browsed. Leaving this with a blank string ” pulls the default list set in the MasterWish Plugin’s options tab.
    return specifies whether you want the title returned or echoed. Default value is false, available options (true/false).
    before is what you want prepended to the wishlist title.
    after is what you want appended to the wishlist title.

  • masterwish_list_url

    retrieves the current list url

    Usage:

    masterwish_list_url({list_id},{return});

    list_id is the wishlist id number that is being browsed. Leaving this with a blank string ” pulls the default list set in the MasterWish Plugin’s options tab.
    return specifies whether you want the title returned or printed on the screen. Default value is false, available options (true/false).

  • masterwish_lists

    retrieves the user’s publicly viewable lists

    Usage:

    masterwish_lists({list_id},{before},{after},{return});

    list_id is the wishlist id number that is being browsed. Leaving this with a blank string ” pulls the default list set in the MasterWish Plugin’s options tab.
    before is what you want prepended to each wishlist title.
    after is what you want appended to each wishlist title.

    return specifies whether you want the lists returned or printed on the screen. Default value is false, available options (true/false).