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

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]

Theming for BuddyPress
Theming for BuddyPressTheming for BuddyPress
Theming for BuddyPress
boonebgorges
 
Buddypress Pasadena Meetup
Buddypress Pasadena MeetupBuddypress Pasadena Meetup
Buddypress Pasadena Meetup
Suzette Franck
 

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

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
 

Recently uploaded (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
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
 
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, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

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