SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
Extending BuddyPress – WordCamp Milano 2011 [italian]
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/
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