public
Created

Custom BuddyPress Activity Stream

  • Download Gist
gistfile1.aw
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
<?php
 
 
/* = Generate Custom Activity Stream
-----------------------------------------------
* Place this function anywhere you want to show your custom stream.
* Should accept any of these parameters:
* http://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/
*/
 
my_activity_stream('per_page=4&page=1&action=new_forum_post,new_blog_comment,new_blog_post,new_forum_topic');
 
 
 
/* = Custom Activity Stream
-----------------------------------------------
* Place this function in bp-custom.php (in your plugins directory)
*/
function my_activity_stream($args ) {
 
if ( bp_has_activities($args) ) : ?>
 
<div class="pagination">
<div class="pag-count"><?php bp_activity_pagination_count() ?></div>
<div class="pagination-links"><?php bp_activity_pagination_links() ?></div>
</div>
 
<ul id="activity-stream" class="activity-list item-list">
 
<?php while ( bp_activities() ) : bp_the_activity(); ?>
 
<li class="<?php bp_activity_css_class() ?>" id="activity-<?php bp_activity_id() ?>">
 
<div class="activity-avatar">
<a href="<?php bp_activity_user_link() ?>">
<?php bp_activity_avatar( 'type=full&width=100&height=100' ) ?>
</a>
</div>
 
<div class="activity-content">
 
<div class="activity-header">
<?php bp_activity_action() ?>
</div>
 
<?php if ( bp_get_activity_content_body() ) : ?>
<div class="activity-inner">
<?php bp_activity_content_body() ?>
</div>
<?php endif; ?>
 
<?php do_action( 'bp_activity_entry_content' ) ?>
 
</div>
</li>
 
<?php endwhile; ?>
 
</ul>
 
<?php else : ?>
<div id="message" class="info">
<p><?php _e( 'Sorry, there was no activity found. Please try a different filter.', 'buddypress' ) ?></p>
</div>
<?php endif;
 
wp_reset_query();
 
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.