Three NEW BuddyPress Plugins! (Custom Groups Name, Group Authors Widget, Group Registration)

UPDATE: This page will no longer be updated.  Instead, please visit the Hardly Neutral WordPress plugins page.

Eric Johnson did all of the coding and deserves all of the credit for these three great plugins!  I commissioned them for a project and am posting them here with Eric’s permission.  As an FYI, these are all open-source, and Eric plans on placing them into the BuddyPress plugin repository in the near future.

  • Custom Groups Name (download)
    Activate this plugin, and you will find that your “groups” turn into “communities”.   This plugin doesn’t do anything more than switch the words.
  • Group Authors Widget (download)
    This widget will display the members of any group with little avatars that link to the members’ respective profile pages.
  • Group Registration (download)
    This plugin gives new members the ability to join groups from the registration screen.  Pretty nifty, eh?!

Please add comments here if you find any bugs or if you have any suggestions.

If you find these plugins useful, please contribute back to the WordPress community.

Enjoy!

How to Unzip Folders on the Server Using a Simple PHP Script

I have been installing WordPress MU and BuddyPress a lot recently as I test and test and test it for a client’s website.  The uploading of files via ftp has been the biggest consumer of time during this process.

Yesterday, I discovered a simple PHP script that makes installing WPMU, BuddyPress, WordPress, or really anything else a quick and painless process.  All you need is a zipped folder!  Here is the script:

1
<?php system('unzip wpmu.zip'); ?>

or Download the PHP file here (but make sure to change the file extension from .txt to .php).

Simply:

  1. Upload your zipped file to the server (in my case, “wpmu.zip”).
  2. Edit unzip.php to point to your file (download unzip.php above).
  3. Upload unzip.php to the same folder as your zipped file.
  4. Open a browser and point it to http://mydomain.com/unzip.php (make sure to change “mydomain.com” to your domain).

That’s it!

How to Create a BuddyPress 1.2 Child Theme

I just spent a good 30 minutes figuring this out, so I thought I would post just in case anyone out there is having a similar mental block.  :)

To create a BuddyPress 1.2 child theme, simply create a new folder in your normal “wp-content/themes” folder and then put a style.css file into that folder with the following code at the top:

/*
Theme Name: YOUR THEME NAME HERE
Theme URI: http://buddypress.org/extend/themes/
Description: YOUR THEME NAME HERE based on default 1.2 theme for BuddyPress.
Version: 1.2
Author: BuddyPress.org
Author URI: http://buddypress.org
Template: bp-default
*/

/* Layout styles for home page, internal pages and blog/directory pages */
@import url( ../../plugins/buddypress/bp-themes/bp-default/_inc/css/default.css );

/* Default theme admin bar styles */
@import url( ../../plugins/buddypress/bp-themes/bp-default/_inc/css/adminbar.css );

Use locate_template instead of TEMPLATEPATH to Include Files in a BuddyPress Child Theme

Today I ran into an interesting problem while developing a BuddyPress theme. I was attempting to include a custom sidebar using PHP’s “include” function. The WordPress codex page on “include tags” gives us this:

<?php include( TEMPLATEPATH . ‘/sidebar-index.php’ ); ?>

The problem is that the above code doesn’t always work when you are utilizing a child theme (I am building a child theme based on the default BuddyPress theme). Rather, you should use the “locate_template” hook:

<?php locate_template( array( ‘sidebar-index.php’ ), true ) ?>

What the “locate_template” hook does is searches the child theme’s template folder before searching the parent theme’s template folder.

Pretty nifty, eh?

HTML Form Validation in WordPress

Yesterday, I was charged with the task of validating a simple HTML form in WordPress. I needed to make sure certain text input fields and a drop-down box contained information before the form was submitted. Surprisingly, WordPress seems to make this a bit difficult.

Here is my solution:

I used Marc Grabanski’s “Clean Form Validation” script. I did the following:

  1. Downloaded cleanValidator.js from Marc’s website.
  2. Added this code to my header:

    <script type=”text/javascript” src=”<?php bloginfo(‘stylesheet_directory’); ?>/js/cleanValidator.js”></script>

  3. Added this code after the “</form>” tag in my WordPress template file:

    <script type=”text/javascript”>
    cleanValidator.init({
    formId: ‘example’,
    inputColors: ['#EDEDED', '#FFFFFF'],
    errorColors: ['#FFFF99', '#CF3339'],
    isRequired: ['first_name', 'last_name', 'email','phone', 'company'],
    isEmail: ['email']
    });
    </script>

  4. Added “id=example” to the form tag:
    <form id=example action=….
  5. That’s it!

I hope this helps you to create a beautifully-simple validated form in WordPress!