SlideShare a Scribd company logo
Extending BuddyPress
           Plugin & Temi




 Francesco Laffi – WordCamp Milano – 27 Maggio 2011
Cos’è BuddyPress

             Blog    Bacheca
    Utenti                     Profili
Commenti                         Amicizie
Taxonomy                         Gruppi
  Templates                  Forum (bbPress)
        Plugin API   Messaggi Privati
Non un semplice plugin
-------------------------------------
Lines of code    WP 3.2b2    BP 1.2.8
-------------------------------------
PHP                102400       57363
JS                  23760        2810
CSS                 20955        5562
HTML                 1952           0
XML                    37           0
-------------------------------------
SUM:               149104       65735
-------------------------------------
Extending BuddyPress

   Componenti (plugins)

 bp-custom.php (snippets)

          Temi
Plugin per BuddyPress
  • sono plugin per WP ma usano le API di
     BP (funzioni, azioni, filtri)
  • eseguire il codice di BP solo dopo che
     viene caricato:
/* Only load code that needs BuddyPress to run once BP is
loaded and initialized. */
function my_plugin_init()
{
    require( dirname( __FILE__ ) . '/my-plugin.php' );
}
add_action( 'bp_include', 'my_plugin_init' );
Componenti
     example.org/groups/my-group/forum/topic/test-topic/


current_component                             action_variables

               current_item        current_action

      example.org/members/francesco/messages/1/view


          Accessibili tramite la variabile globale $bp
   http://codex.buddypress.org/developer-docs/the-bp-global/
Struttura dei componenti


            • Struttura standard
            • Usata anche per le
              funzionalità base di
              BuddyPress
BP Skeleton Component


   • Esempio di componente “high five”
   • Buona base di partenza per
      componenti personalizzati


http://wordpress.org/extend/plugins/buddypress-skeleton-component/
Extending BuddyPress

   Componenti (plugins)

 bp-custom.php (snippets)

          Temi
bp-custom.php
•   wp-content/plugins/bp-custom.php

•   snippets di codice, piccole modifiche

•   cambiare slug ai forum:
          define('BP_FORUMS_SLUG', 'board');


•   rimuovere i link cliccabili dal profilo:

       function remove_xprofile_links()
       {
       	 remove_filter('bp_get_the_profile_field_value',
                 'xprofile_filter_link_profile_data', 50, );
       }
       add_action('plugins_loaded', 'remove_xprofile_links');
Extending BuddyPress

   Componenti (plugins)

 bp-custom.php (snippets)

          Temi
bp-default theme
URL                    Template
URL: example.org/members/francesco/messages/compose/

Template: bp-default/members/single/messages/compose.php
i “Loop”
    •   The Activity Stream Loop / bp_has_activities()
    •   The Forum Topics Loop / bp_has_forum_topics()
    •   The Members Loop / bp_has_members()
    •   The Groups Loop / bp_has_groups()
    •   The Blogs Loop / bp_has_blogs()
    •   The Group Members Loop / bp_group_has_members()
    •   The Private Messages Loop / bp_has_message_threads()
    •   The Profile Data Loop / bp_has_profile()


http://codex.buddypress.org/developer-docs/custom-buddypress-loops/
Group Members Loop
  <?php if ( bp_group_has_members() ) : ?>
    <div id="member-count" class="pag-count">
      <?php bp_group_member_pagination_count() ?>
    </div>
    <div id="member-pagination" class="pagination-links">
      <?php bp_group_member_pagination() ?>
    </div>
    <ul id="member-list" class="item-list">
    <?php while ( bp_group_members() ) : bp_group_the_member(); ?>
      <li>
        <!-- Example template tags you can use -->
        <?php bp_group_member_avatar() ?>
  	     <?php bp_group_member_link() ?>
        <?php bp_group_member_joined_since() ?>
  	   </li>
    <?php endwhile; ?>
    </ul>
  <?php else: ?>
    <div id="message" class="info">
      <p>This group has no members.</p>
    </div>
  <?php endif;?>
Temi personalizzati

• bp-default child theme
 • si aggiorna con buddypress
• WP->BP: BuddyPress Template Pack
 http://wordpress.org/extend/plugins/bp-template-pack/
Risorse
•   BP Codex: http://codex.buddypress.org/home/

•   Forums: http://buddypress.org/community/
    groups/creating-extending/forum/

•   IRC: #buddypress-dev su Freenode

•   BP Dev Blog: http://bpdevel.wordpress.com/

•   PHPXref e Doxygen

•   Trac: http://buddypress.trac.wordpress.org/
Q&A
     Francesco Laffi
   francesco@flweb.it

twitter.com/francescolaffi
      http://flweb.it

More Related Content

What's hot

Daughter Themes
Daughter ThemesDaughter Themes
Daughter Themes
Paul Bearne
 
Build a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ TelerikBuild a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ Telerik
Mario Peshev
 
WordPress 3.0 at DC PHP
WordPress 3.0 at DC PHPWordPress 3.0 at DC PHP
WordPress 3.0 at DC PHP
andrewnacin
 
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Richard Calderon
 
Bjvenus getting-started
Bjvenus getting-startedBjvenus getting-started
Bjvenus getting-started
By Joomla
 
Introduction to building joomla! components using FOF
Introduction to building joomla! components using FOFIntroduction to building joomla! components using FOF
Introduction to building joomla! components using FOF
Tim Plummer
 

What's hot (6)

Daughter Themes
Daughter ThemesDaughter Themes
Daughter Themes
 
Build a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ TelerikBuild a WordPress theme from HTML5 template @ Telerik
Build a WordPress theme from HTML5 template @ Telerik
 
WordPress 3.0 at DC PHP
WordPress 3.0 at DC PHPWordPress 3.0 at DC PHP
WordPress 3.0 at DC PHP
 
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
 
Bjvenus getting-started
Bjvenus getting-startedBjvenus getting-started
Bjvenus getting-started
 
Introduction to building joomla! components using FOF
Introduction to building joomla! components using FOFIntroduction to building joomla! components using FOF
Introduction to building joomla! components using FOF
 

Similar to Extending BuddyPress – WordCamp Milano 2011 [italian]

Buddy Press 10-19-2012
Buddy Press 10-19-2012Buddy Press 10-19-2012
Buddy Press 10-19-2012
Thomas Carney
 
Theming for BuddyPress
Theming for BuddyPressTheming for BuddyPress
Theming for BuddyPress
boonebgorges
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
Brad Williams
 
Buddypress Pasadena Meetup
Buddypress Pasadena MeetupBuddypress Pasadena Meetup
Buddypress Pasadena Meetup
Suzette Franck
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
Brad Williams
 
WordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media InstituteWordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media Institute
Brendan Sera-Shriar
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
Chandra Prakash Thapa
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
certainstrings
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend Development
Kapil Dev Singh
 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Theme
certainstrings
 
WordPress
WordPressWordPress
WordPress
risager
 
Write Your First WordPress Plugin
Write Your First WordPress PluginWrite Your First WordPress Plugin
Write Your First WordPress Plugin
Ibrahim Abdel Fattah Mohamed
 
Theming 101
Theming 101Theming 101
Theming 101
WinnipegWordcamp
 
Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012
Bastian Grimm
 
Customizing a BuddyPress community website
Customizing a BuddyPress community websiteCustomizing a BuddyPress community website
Customizing a BuddyPress community website
Sylvie Clément
 
Optimize wordpress
Optimize wordpressOptimize wordpress
Optimize wordpress
David Parsons
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
Steve Mortiboy
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
Sitdhibong Laokok
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
David Bisset
 
Ci2
Ci2Ci2

Similar to Extending BuddyPress – WordCamp Milano 2011 [italian] (20)

Buddy Press 10-19-2012
Buddy Press 10-19-2012Buddy Press 10-19-2012
Buddy Press 10-19-2012
 
Theming for BuddyPress
Theming for BuddyPressTheming for BuddyPress
Theming for BuddyPress
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
 
Buddypress Pasadena Meetup
Buddypress Pasadena MeetupBuddypress Pasadena Meetup
Buddypress Pasadena Meetup
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
 
WordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media InstituteWordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media Institute
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend Development
 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Theme
 
WordPress
WordPressWordPress
WordPress
 
Write Your First WordPress Plugin
Write Your First WordPress PluginWrite Your First WordPress Plugin
Write Your First WordPress Plugin
 
Theming 101
Theming 101Theming 101
Theming 101
 
Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012
 
Customizing a BuddyPress community website
Customizing a BuddyPress community websiteCustomizing a BuddyPress community website
Customizing a BuddyPress community website
 
Optimize wordpress
Optimize wordpressOptimize wordpress
Optimize wordpress
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
 
Ci2
Ci2Ci2
Ci2
 

Recently uploaded

A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
ScyllaDB
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
christinelarrosa
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Pitangent Analytics & Technology Solutions Pvt. Ltd
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 

Recently uploaded (20)

A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
Crafting Excellence: A Comprehensive Guide to iOS Mobile App Development Serv...
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 

Extending BuddyPress – WordCamp Milano 2011 [italian]

  • 1. Extending BuddyPress Plugin & Temi Francesco Laffi – WordCamp Milano – 27 Maggio 2011
  • 2. Cos’è BuddyPress Blog Bacheca Utenti Profili Commenti Amicizie Taxonomy Gruppi Templates Forum (bbPress) Plugin API Messaggi Privati
  • 3. Non un semplice plugin ------------------------------------- Lines of code WP 3.2b2 BP 1.2.8 ------------------------------------- PHP 102400 57363 JS 23760 2810 CSS 20955 5562 HTML 1952 0 XML 37 0 ------------------------------------- SUM: 149104 65735 -------------------------------------
  • 4. Extending BuddyPress Componenti (plugins) bp-custom.php (snippets) Temi
  • 5. Plugin per BuddyPress • sono plugin per WP ma usano le API di BP (funzioni, azioni, filtri) • eseguire il codice di BP solo dopo che viene caricato: /* Only load code that needs BuddyPress to run once BP is loaded and initialized. */ function my_plugin_init() {     require( dirname( __FILE__ ) . '/my-plugin.php' ); } add_action( 'bp_include', 'my_plugin_init' );
  • 6. Componenti example.org/groups/my-group/forum/topic/test-topic/ current_component action_variables current_item current_action example.org/members/francesco/messages/1/view Accessibili tramite la variabile globale $bp http://codex.buddypress.org/developer-docs/the-bp-global/
  • 7. Struttura dei componenti • Struttura standard • Usata anche per le funzionalità base di BuddyPress
  • 8. BP Skeleton Component • Esempio di componente “high five” • Buona base di partenza per componenti personalizzati http://wordpress.org/extend/plugins/buddypress-skeleton-component/
  • 9. Extending BuddyPress Componenti (plugins) bp-custom.php (snippets) Temi
  • 10. bp-custom.php • wp-content/plugins/bp-custom.php • snippets di codice, piccole modifiche • cambiare slug ai forum: define('BP_FORUMS_SLUG', 'board'); • rimuovere i link cliccabili dal profilo: function remove_xprofile_links() { remove_filter('bp_get_the_profile_field_value', 'xprofile_filter_link_profile_data', 50, ); } add_action('plugins_loaded', 'remove_xprofile_links');
  • 11. Extending BuddyPress Componenti (plugins) bp-custom.php (snippets) Temi
  • 13. URL Template URL: example.org/members/francesco/messages/compose/ Template: bp-default/members/single/messages/compose.php
  • 14. i “Loop” • The Activity Stream Loop / bp_has_activities() • The Forum Topics Loop / bp_has_forum_topics() • The Members Loop / bp_has_members() • The Groups Loop / bp_has_groups() • The Blogs Loop / bp_has_blogs() • The Group Members Loop / bp_group_has_members() • The Private Messages Loop / bp_has_message_threads() • The Profile Data Loop / bp_has_profile() http://codex.buddypress.org/developer-docs/custom-buddypress-loops/
  • 15. Group Members Loop <?php if ( bp_group_has_members() ) : ?> <div id="member-count" class="pag-count"> <?php bp_group_member_pagination_count() ?> </div> <div id="member-pagination" class="pagination-links"> <?php bp_group_member_pagination() ?> </div> <ul id="member-list" class="item-list"> <?php while ( bp_group_members() ) : bp_group_the_member(); ?> <li> <!-- Example template tags you can use --> <?php bp_group_member_avatar() ?> <?php bp_group_member_link() ?> <?php bp_group_member_joined_since() ?> </li> <?php endwhile; ?> </ul> <?php else: ?> <div id="message" class="info"> <p>This group has no members.</p> </div> <?php endif;?>
  • 16. Temi personalizzati • bp-default child theme • si aggiorna con buddypress • WP->BP: BuddyPress Template Pack http://wordpress.org/extend/plugins/bp-template-pack/
  • 17. Risorse • BP Codex: http://codex.buddypress.org/home/ • Forums: http://buddypress.org/community/ groups/creating-extending/forum/ • IRC: #buddypress-dev su Freenode • BP Dev Blog: http://bpdevel.wordpress.com/ • PHPXref e Doxygen • Trac: http://buddypress.trac.wordpress.org/
  • 18. Q&A Francesco Laffi francesco@flweb.it twitter.com/francescolaffi http://flweb.it