Extending BuddyPress – WordCamp Milano 2011 [italian]

  • 3,089 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,089
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
11
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Extending BuddyPress Plugin & Temi Francesco Laffi – WordCamp Milano – 27 Maggio 2011
  • 2. Cos’è BuddyPress Blog Bacheca Utenti ProfiliCommenti AmicizieTaxonomy 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 57363JS 23760 2810CSS 20955 5562HTML 1952 0XML 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 isloaded 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 personalizzatihttp://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
  • 12. bp-default theme
  • 13. URL TemplateURL: 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.ittwitter.com/francescolaffi http://flweb.it