Real-world testing of BuddyPress WP-CLI commands

A few years ago, I started a wp-cli-buddypress project. I occasionally added commands that were useful to me personally, but didn’t pretend to have anything close to complete coverage. A few months ago, Renato Alves (@espellcaste) contacted me to see whether he could help flesh out some of the missing commands. We moved the repo to the official BuddyPress GitHub account https://github.com/buddypress/wp-cli-buddypress, opened a BP ticket to track the potential integration of the commands into BP itself https://buddypress.trac.wordpress.org/ticket/7604, and got to work.

Since that time, Renato and I have done extensive work to bring basic CLI commands to all the main components of BuddyPress. Specifically, we have CRUD commands for all major content types, as well as a few helpful utility methods. The list of supported commands is too long to list here – you can explore by typing <code>wp bp</code> and digging down through the tree – but here’s a very brief summary:

  • activity – CRUD commands, comment management, favorite management, spam/unspam
  • core – Component activation and deactivation
  • group – CRUD commands, member listing and management, invitation management
  • member – bulk generation
  • signup – CRUD commands, activation, resending
  • tool – commands for running any BP repair tool
  • xprofile – CRUD commands for groups, fields, and user data

While there’s more to build – and refinements to be made – we’re at a point where we need real-world testing and feedback. If you are a BP developer, or administer BP-powered sites, and if you use WP-CLI, please install wp-cli-buddypress today and start using it.

There are numerous ways to install a wp-cli package, but because this one is in development, we encourage you to get a repo checkout. Something like:

$ git clone https://github.com/buddypress/wp-cli-buddypress ~/.wp-cli/commands

and then add the path to wp-cli-buddypress/wp-cli-bp.php to the commands subsection of your wp-cli config file https://make.wordpress.org/cli/handbook/config/#config-files.

Questions to consider while using the commands:

  • Are the commands named in a way that makes sense? Note that in some cases, commands have aliases (eg wp bp group create and wp bp group add).
  • Think about argument patterns across the commands, and whether they are consistent and make sense. Some commands take certain positional arguments (wp bp group get my-group) while others require named arguments (wp bp xprofile data get --user-id=5 --field-id=10)
  • What major features are missing?

For specific issues, you’re encouraged to open a GitHub ticket: https://github.com/buddypress/wp-cli-buddypress/issues. For high-level discussions, you can open a GitHub ticket, leave a comment here, or drop into the #buddypress channel on wordpress.org Slack.

And for the truly intrepid: Contributions are encouraged! We’ve worked hard to ensure 100% Behat test coverage, which makes writing new commands fun.

#wp-cli