Extending BuddyPress           Plugin & Temi Francesco Laffi – WordCamp Milano – 27 Maggio 2011
Cos’è BuddyPress             Blog    Bacheca    Utenti                     ProfiliCommenti                         Amicizie...
Non un semplice plugin-------------------------------------Lines of code    WP 3.2b2    BP 1.2.8--------------------------...
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 B...
Componenti     example.org/groups/my-group/forum/topic/test-topic/current_component                             action_var...
Struttura dei componenti            • Struttura standard            • Usata anche per le              funzionalità base di...
BP Skeleton Component   • Esempio di componente “high five”   • Buona base di partenza per      componenti personalizzatiht...
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:      ...
Extending BuddyPress   Componenti (plugins) bp-custom.php (snippets)          Temi
bp-default theme
URL                    TemplateURL: example.org/members/francesco/messages/compose/Template: bp-default/members/single/mes...
i “Loop”    •   The Activity Stream Loop / bp_has_activities()    •   The Forum Topics Loop / bp_has_forum_topics()    •  ...
Group Members Loop  <?php if ( bp_group_has_members() ) : ?>    <div id="member-count" class="pag-count">      <?php bp_gr...
Temi personalizzati• bp-default child theme • si aggiorna con buddypress• WP->BP: BuddyPress Template Pack http://wordpres...
Risorse•   BP Codex: http://codex.buddypress.org/home/•   Forums: http://buddypress.org/community/    groups/creating-exte...
Q&A     Francesco Laffi   francesco@flweb.ittwitter.com/francescolaffi      http://flweb.it
Upcoming SlideShare
Loading in …5
×

Extending BuddyPress – WordCamp Milano 2011 [italian]

3,487
-1

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,487
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
12
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Extending BuddyPress – WordCamp Milano 2011 [italian]

  1. 1. Extending BuddyPress Plugin & Temi Francesco Laffi – WordCamp Milano – 27 Maggio 2011
  2. 2. Cos’è BuddyPress Blog Bacheca Utenti ProfiliCommenti AmicizieTaxonomy Gruppi Templates Forum (bbPress) Plugin API Messaggi Privati
  3. 3. Non un semplice plugin-------------------------------------Lines of code WP 3.2b2 BP 1.2.8-------------------------------------PHP 102400 57363JS 23760 2810CSS 20955 5562HTML 1952 0XML 37 0-------------------------------------SUM: 149104 65735-------------------------------------
  4. 4. Extending BuddyPress Componenti (plugins) bp-custom.php (snippets) Temi
  5. 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 isloaded and initialized. */function my_plugin_init(){    require( dirname( __FILE__ ) . /my-plugin.php );}add_action( bp_include, my_plugin_init );
  6. 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. 7. Struttura dei componenti • Struttura standard • Usata anche per le funzionalità base di BuddyPress
  8. 8. BP Skeleton Component • Esempio di componente “high five” • Buona base di partenza per componenti personalizzatihttp://wordpress.org/extend/plugins/buddypress-skeleton-component/
  9. 9. Extending BuddyPress Componenti (plugins) bp-custom.php (snippets) Temi
  10. 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. 11. Extending BuddyPress Componenti (plugins) bp-custom.php (snippets) Temi
  12. 12. bp-default theme
  13. 13. URL TemplateURL: example.org/members/francesco/messages/compose/Template: bp-default/members/single/messages/compose.php
  14. 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. 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. 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. 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. 18. Q&A Francesco Laffi francesco@flweb.ittwitter.com/francescolaffi http://flweb.it
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×