SlideShare a Scribd company logo
1 of 18
Download to read offline
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

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 @ TelerikMario Peshev
 
WordPress 3.0 at DC PHP
WordPress 3.0 at DC PHPWordPress 3.0 at DC PHP
WordPress 3.0 at DC PHPandrewnacin
 
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-startedBy 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 FOFTim 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-2012Thomas Carney
 
Theming for BuddyPress
Theming for BuddyPressTheming for BuddyPress
Theming for BuddyPressboonebgorges
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentBrad Williams
 
Buddypress Pasadena Meetup
Buddypress Pasadena MeetupBuddypress Pasadena Meetup
Buddypress Pasadena MeetupSuzette Franck
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress PluginBrad 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 InstituteBrendan 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 NepalChandra Prakash Thapa
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Themecertainstrings
 
Magento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentMagento2 Basics for Frontend Development
Magento2 Basics for Frontend DevelopmentKapil Dev Singh
 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Themecertainstrings
 
WordPress
WordPressWordPress
WordPressrisager
 
Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Advanced WordPress Optimization - iGaming Supershow 2012
Advanced WordPress Optimization - iGaming Supershow 2012Bastian Grimm
 
Customizing a BuddyPress community website
Customizing a BuddyPress community websiteCustomizing a BuddyPress community website
Customizing a BuddyPress community websiteSylvie Clément
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress developmentSteve Mortiboy
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentSitdhibong Laokok
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3David Bisset
 

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

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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, Adobeapidays
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

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