BuddyPress
Group Extension API

          Andy Peatling
                @apeatling
    buddypress.org/developers/apeatling
What’s API?
      Are People Interested
       Angry People Inc.


Application Programming
        Interface
        All P...
It’s all about

Abstraction
Me (developer)


Writing code without an API
     More complex and scattered code

     When the app changes, my code brea...
Me (developer)


      Writing code using an API
            Simple and standardized code
API
            When the app cha...
A Real World Example
              Fetch posts in WordPress without an API


Work out the query you need, check the databa...
A Real World Example
       Fetch posts in WordPress without an API


  If the database schema changes in a new version of...
A Real World Example
                Fetch posts in WordPress using the API


Fetch the posts you need, who cares about th...
A Real World Example
         Fetch posts in WordPress using the API


No need to worry about database changes, get_posts(...
The WordPress API is Everywhere
                    wp_authenticate()
get_posts()


                          WP_Widget
  ...
BuddyPress Group Extension API
   Making it very simple to build new
       custom group features
Let’s Build a Twitter Extension
         Live Demo... gulp.
Thank You!

http://codex.buddypress.org/developer-docs/group-
                  extension-api/

Submit your group extensio...
BuddyPress Groups API
BuddyPress Groups API
BuddyPress Groups API
BuddyPress Groups API
BuddyPress Groups API
BuddyPress Groups API
Upcoming SlideShare
Loading in …5
×

BuddyPress Groups API

6,416 views
6,264 views

Published on

Creating killer group extensions with BuddyPress.

Published in: Technology
4 Comments
13 Likes
Statistics
Notes
No Downloads
Views
Total views
6,416
On SlideShare
0
From Embeds
0
Number of Embeds
338
Actions
Shares
0
Downloads
45
Comments
4
Likes
13
Embeds 0
No embeds

No notes for slide

BuddyPress Groups API

  1. 1. BuddyPress Group Extension API Andy Peatling @apeatling buddypress.org/developers/apeatling
  2. 2. What’s API? Are People Interested Angry People Inc. Application Programming Interface All Peanuts Inside Another Pointless Idea
  3. 3. It’s all about Abstraction
  4. 4. Me (developer) Writing code without an API More complex and scattered code When the app changes, my code breaks! Usually quite “hacky” Application
  5. 5. Me (developer) Writing code using an API Simple and standardized code API When the app changes, the API takes care of it, your code doesn’t break! Lower barrier for entry Application
  6. 6. A Real World Example Fetch posts in WordPress without an API Work out the query you need, check the database? SELECT ID FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 20 Loop the results manually foreach ( (array) $posts as $post ) .... What about security? Oh dear... wp_esc() ... wp_filter_kses() ??
  7. 7. A Real World Example Fetch posts in WordPress without an API If the database schema changes in a new version of WordPress, your code breaks. If the post fields change in a new version of WordPress, your code knows nothing about them. Your code is hacker fodder.
  8. 8. A Real World Example Fetch posts in WordPress using the API Fetch the posts you need, who cares about the database? get_posts( ‘numberposts=20’ ); Loop the results using the built in WordPress loop <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); Security? No worries. the_content(); the_title(); the_tags();
  9. 9. A Real World Example Fetch posts in WordPress using the API No need to worry about database changes, get_posts() will update in new versions of WordPress. If new post fields are available, you can use them in your code using new template tags. Your code is safe.... hopefully. :)
  10. 10. The WordPress API is Everywhere wp_authenticate() get_posts() WP_Widget get_usermeta() add_filter() add_action() current_user_can() update_usermeta()
  11. 11. BuddyPress Group Extension API Making it very simple to build new custom group features
  12. 12. Let’s Build a Twitter Extension Live Demo... gulp.
  13. 13. Thank You! http://codex.buddypress.org/developer-docs/group- extension-api/ Submit your group extensions to the WordPress plugin repo tagged with “BuddyPress”.

×