of 19 /19
Group Extension API buddypress.org/developers/apeatling @apeatling Andy Peatling BuddyPress

BuddyPress Groups API

Embed Size (px)

DESCRIPTION

Creating killer group extensions with BuddyPress.

Text of BuddyPress Groups API

  • 1.BuddyPress Group Extension APIAndy Peatling @apeatling buddypress.org/developers/apeatling

2. Whats API? Are People InterestedAngry People Inc. Application Programming Interface All Peanuts Inside Another Pointless Idea 3. Its all aboutAbstraction 4. Me (developer) Writing code without an APIMore complex and scattered code When the app changes, my code breaks! Usually quite hackyApplication 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 doesnt break! Lower barrier for entry Application 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 20Loop the results manually foreach ( (array) $posts as $post ) ....What about security? Oh dear... wp_esc() ... wp_filter_kses() ?? 7. A Real World ExampleFetch posts in WordPress without an API If the database schema changes in a new version ofWordPress, 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. 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