BuddyPressifying

a WordPress plugin

using BP_Component

Boone B Gorges · @boone

WPSessions

21 June 2014

Boone

  • is a Lead Developer for BuddyPress
  • is a freelance consultant and developer
  • is a well known BuddyPressifier

These slides

blo.so/wpsessions

Social networking for WordPress

BuddyPress in action


Project Hieroglyph

hieroglyph.asu.edu

Project Hieroglyph - hieroglyph.asu.edu

Hieroglpyh is a space for writers, scientists, artists and engineers to collaborate on creative, ambitious visions of our near future.

Project Hieroglyph - hieroglyph.asu.edu

Member Profiles

Project Hieroglyph - hieroglyph.asu.edu

Topic-based Groups

Project Hieroglyph - hieroglyph.asu.edu

Activity Stream as Ticker

Project Hieroglyph - hieroglyph.asu.edu

BuddyPress is extensible


  • New Groups functionality using BP_Group_Extension
  • Integration into the Activity Stream
  • Custom Member components using BP_Component

What is a Component ?

BP "core" components


  •  
    Activity Streams
  •  
    Blog Tracking
  •  
    Friendships
  •  
    Groups
  •  
    Private Messaging
  •  
    User Profiles

componenttab

BP_Component

  • Proper registration with BuddyPress "globals"
  • Hassle-free hooks and load order
  • Integration into user navigation
  • Tools for registering display callbacks
  • Integration into WP toolbar

BP_Component

In a few easy steps

Ultra simple sample component

https://github.com/boonebgorges/bp-display-user-posts/

Step 1: Load with care

Only load BuddyPress-specific content on the 'bp-include' hook, to ensure that BP has been loaded.

Example

Step 2: Extend BP_Component

Pick a unique class name to extend the abstract BP_Component.

Example

Step 3: start() me up

In your __construct() method, call parent::start() with the id and name of your component.

Example

Step 4: Use setup_globals() to, er, set up globals

The minimum information that setup_globals() needs is your component's slug, used to build URLs.

Example

Step 5: Define the navigation

Set up a few config arrays, and setup_nav() will integrate your component into BP's user nav.

Example

Step 6: Use BP's plugins.php template to hold your content

BuddyPress is flexible about how you load your component's content, but using plugins.php, and hooking your markup-generating function to 'bp_template_content', is the best way to ensure compatibility across themes.

Example

Step 7: Let BuddyPress know you exist

The best practice is to invoke your component at the 'bp_loaded' hook - late enough to know that the rest of BP is loaded, but early enough that you'll be able to set up the page and any necessary redirects.

Example

Another example: Integrate Subscribe2 into BuddyPress

https://github.com/boonebgorges/subscribe2/

More resources

Thanks!

Boone B Gorges · @boone