SlideShare una empresa de Scribd logo
1 de 19
Descargar para leer sin conexión
BuddyPress
Group Extension API

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


Application Programming
        Interface
        All Peanuts Inside
      Another Pointless Idea
It’s all about

Abstraction
Me (developer)


Writing code without an API
     More complex and scattered code

     When the app changes, my code breaks!

     Usually quite “hacky”


       Application
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
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() ??
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.
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();
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. :)
The WordPress API is Everywhere
                    wp_authenticate()
get_posts()


                          WP_Widget
       get_usermeta()


                      add_filter()
 add_action()


                      current_user_can()
update_usermeta()
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 extensions to the WordPress plugin
          repo tagged with “BuddyPress”.

Más contenido relacionado

Similar a BuddyPress Groups API

Bending word press to your will
Bending word press to your willBending word press to your will
Bending word press to your will
Tom Jenkins
 
Development workflow
Development workflowDevelopment workflow
Development workflow
Sigsiu.NET
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress plugin
Mainak Goswami
 
Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress plugin
Anthony Montalbano
 
Building native mobile apps with word press
Building native mobile apps with word pressBuilding native mobile apps with word press
Building native mobile apps with word press
Nikhil Vishnu P.V
 

Similar a BuddyPress Groups API (20)

Bending word press to your will
Bending word press to your willBending word press to your will
Bending word press to your will
 
WordCamp Wilmington 2017 WP-API Why?
WordCamp Wilmington 2017   WP-API Why?WordCamp Wilmington 2017   WP-API Why?
WordCamp Wilmington 2017 WP-API Why?
 
Development workflow
Development workflowDevelopment workflow
Development workflow
 
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011WordPress Theme & Plugin development best practices - phpXperts seminar 2011
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
 
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
 
WORDPRESS_REST_API_WORDPRESS_REST_API.pdf
WORDPRESS_REST_API_WORDPRESS_REST_API.pdfWORDPRESS_REST_API_WORDPRESS_REST_API.pdf
WORDPRESS_REST_API_WORDPRESS_REST_API.pdf
 
IPaste SDK v.1.0
IPaste SDK v.1.0IPaste SDK v.1.0
IPaste SDK v.1.0
 
Build and Distributing SDK Add-Ons
Build and Distributing SDK Add-OnsBuild and Distributing SDK Add-Ons
Build and Distributing SDK Add-Ons
 
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017 So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
So, You Wanna Dev? Join the Team! - WordCamp Raleigh 2017
 
I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015
 
Plugin Development - WP Meetup Antwerp
Plugin Development - WP Meetup AntwerpPlugin Development - WP Meetup Antwerp
Plugin Development - WP Meetup Antwerp
 
PHP and Zend Framework on Windows
PHP and Zend Framework on WindowsPHP and Zend Framework on Windows
PHP and Zend Framework on Windows
 
44CON 2014 - Advanced Excel Hacking, Didier Stevens
44CON 2014 - Advanced Excel Hacking, Didier Stevens44CON 2014 - Advanced Excel Hacking, Didier Stevens
44CON 2014 - Advanced Excel Hacking, Didier Stevens
 
WordPress Bootcamp Quiz
WordPress Bootcamp QuizWordPress Bootcamp Quiz
WordPress Bootcamp Quiz
 
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentWordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
 
Step by step guide for creating wordpress plugin
Step by step guide for creating wordpress pluginStep by step guide for creating wordpress plugin
Step by step guide for creating wordpress plugin
 
Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress plugin
 
Building native mobile apps with word press
Building native mobile apps with word pressBuilding native mobile apps with word press
Building native mobile apps with word press
 
Building a developer friendly plugin - WordCamp Chicago 2017
Building a developer friendly plugin - WordCamp Chicago 2017Building a developer friendly plugin - WordCamp Chicago 2017
Building a developer friendly plugin - WordCamp Chicago 2017
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

BuddyPress Groups API

  • 1. BuddyPress Group Extension API Andy Peatling @apeatling buddypress.org/developers/apeatling
  • 2. What’s API? Are People Interested Angry People Inc. Application Programming Interface All Peanuts Inside Another Pointless Idea
  • 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. 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. 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. 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. 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. 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. The WordPress API is Everywhere wp_authenticate() get_posts() WP_Widget get_usermeta() add_filter() add_action() current_user_can() update_usermeta()
  • 11. BuddyPress Group Extension API Making it very simple to build new custom group features
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. Let’s Build a Twitter Extension Live Demo... gulp.
  • 19. Thank You! http://codex.buddypress.org/developer-docs/group- extension-api/ Submit your group extensions to the WordPress plugin repo tagged with “BuddyPress”.