Posts Tagged ‘BuddyPress’

My Groups widget for BuddyPress

March 19th, 2010

I had a client request a modification of the “Groups” widget for BuddyPress.  Instead, it should be limited to the groups for the logged in user.  And so, I give you the “My Groups” widget.  It will display all the groups for the user alphabetially sorted.  Cheers.

bp-my-groups-widget.php (zip)

Buddypress Group Invite by Email

March 17th, 2010

Here’s another small plugin I wrote: Group Invite By Email.  Basically, it adds an email field to the bottom of the usual “send-invites” screen.  Then, when you click “send invites” it sends the person a nice little email explaining they’ve been invited to your group, and giving them a link to register on your site.

Once they complete the registration, it automatically adds them to the group.  It does this by checking their email address against a list of outstanding invites.  This removes the extra hassle of needing to invite them to the group after you’ve gotten them to sign up, and them needing to approve your group invitation.

In the future, this functionality will likely be bundled with another plugin already existing: Invite Anyone. That plugin allows you to invite non-friends to your group; this one allows you to invite non-members.

Here it is:
buddypress-group-invite-email (.zip)

Buddypress Default Forum Topic

March 14th, 2010

This plugin I wrote that creates a default topic for each group forum in BuddyPress.  Please note, you have to open up the PHP file, and replace the values for the default title and text with what you would like to use.  Even if you are unfamiliar with PHP, this should be very straightforward.

To Install:
-Extract and upload the files to your wp-content/plugins/ folder.
-Go to the “Plugins” screen on the admin dashboard, and activate the plugin

Here it is:
default-forum-topic (.zip)

Buddypress Group Document Store

December 24th, 2009

I just uploaded my largest wordpress plugin yet: Buddypress Group Documents!

Group Documents creates a page within each BuddyPress group to upload and store documents.  Documents can be edited and deleted either by the owner or by the group administrator.  Document activity is logged in the main activity stream, and is also tied to the user and group activity streams.  The site administrator can set filters on file extensions, and soon (in the next update) users can set email notification preferences.  There is also a “Recent Uploads” widget than can be used to show any number of uploaded documents.

Get it while it’s hot! Plugin Download Page

Make sure WPMU and BuddyPress are installed and active.
Copy the plugin folder buddypress-group-documents/ into /wp-content/plugins/

Browse to the plugin administration screen and activate the plugin.

There will now be a “Group Documents” menu item under the “BuddyPress” menu.  Here you will find a list of all file extensions allowed for uploaded files.  Please check and make sure the list suits you.

Please don’t hesitate to contact me, especially if you run into trouble.  I will respond promptly.  email hidden; JavaScript is required

Buddypress jQuery is not defined error

December 16th, 2009

While developing a Buddypress plugin, I was running into a problem where none of my Javascript was working. Instead, Firebug was telling me: “jQuery is not defined”.  This was quite frustrating, as I could verify that the jQuery file was indeed, being loaded.  While a few other people received the same error for different reasons (corrupt files, etc.) I did not quickly find the solution for my problem.  Here it is:

Problem: Buddypress calls your plugin’s JS files BEFORE jQuery files.
This applies when you use the function wp_enqueue_script() – as you should.

Solution: Tell wp_enqueue_script your file depends on jQuery.
It turns out, wp_enqueue_script() takes a few optional parameters – the third being an array of other js files yours is dependent on.

Here’s how the call looks after the change:

Viola!  Your js file is now loaded after jQuery and you’re good to go.

Using Custom Profile Field Data in Buddypress Templates

November 18th, 2009

I ran into what I thought would be fairly common need for Buddypress theme development, the ability to pull data from a custom user profile field and display it. After searching a bit, I could only find way to pull either random fields, or all of the fields together. So after digging around in the core files, I found the pieces to put together my own function for the task.

1. Create the file “bp-custom.php” and place it directly in the plugins folder. Note, do not place it in the “buddypress” folder, otherwise it will be overwritten when upgrading. If the file exists, simply append to it rather than creating a new one.

2. Paste the following function in:

function bp_the_site_member_profile_data($field_name = '', $echo = 1) {
  if( !$field_name ) {
    return false;
  global $site_members_template;
  if( function_exists( 'xprofile_get_field_data' ) ) {
    $data = xprofile_get_field_data( $field_name,
    if( $echo ) {
      echo "$data";
      return true;
    } else {
      return $data;

3. You can now use the function ‘bp_the_site_member_profile_data(‘MyField’) in your templates (of course, substituting ‘MyField’ with the one you’d like to use). Note, this must be place inside a ‘Members Loop’ so that the $site_members_template variable is populated.  Odds are, you’re inserting this near other profile data already in the loop, so there should be no problems.

As of BuddyPress 1.2, this functionality has been included. While in the members loop, you can use the included function: ‘bp_member_profile_data( ‘field=the field name’ )’ to much the same effect.