Re: Groups tab…add most recent post blurb under group description.
@nuprn1 @mercime @boonebgorges
Thank you for leading me to the code to get to this… I basically just did a super-slight mod of Rich’s code. Here is what I used and I put it in the the bp-custom.php file in the plugins directory:
`<? function my_group_loop_activity_item() {
global $bp, $activities_template;
if ( !bp_is_active( ‘activity’ ) )
return;
if ( !bp_group_is_visible() )
return;
$show_hidden = false;
/* Group filtering */
$object = $bp->groups->id;
$primary_id = bp_get_group_id();
if ( ‘public’ != $bp->groups->current_group->status && groups_is_user_member( $bp->loggedin_user->id, bp_get_group_id() ) )
$show_hidden = true;
/* Note: any params used for filtering can be a single value, or multiple values comma separated. */
$defaults = array(
‘display_comments’ => false, // false for none, stream/threaded – show comments in the stream or threaded under items
‘sort’ => ‘DESC’, // sort DESC or ASC
‘page’ => 1, // which page to load
‘per_page’ => false, // number of items per page
‘max’ => 1, // max number to return
‘include’ => false, // pass an activity_id or string of ID’s comma separated
‘show_hidden’ => $show_hidden, // Show activity items that are hidden site-wide?
/* Filtering */
‘object’ => $object, // object to filter on e.g. groups, profile, status, friends
‘primary_id’ => $primary_id, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
‘action’ => ‘new_forum_topic’, // action to filter on e.g. activity_update, new_forum_post, profile_updated
‘secondary_id’ => false, // secondary object ID to filter on e.g. a post_id
/* Searching */
‘search_terms’ => false // specify terms to search on
);
$r = wp_parse_args( $args, $defaults );
extract( $r );
$filter = array( ‘user_id’ => false, ‘object’ => $object, ‘action’ => $action, ‘primary_id’ => $primary_id, ‘secondary_id’ => $secondary_id );
$activities_template = new BP_Activity_Template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden );
while ( bp_activities() ) : bp_the_activity(); ?>
<div class="item-descb" id="activity-“>
Latest Topic Activity in the Group:
<a href="”>
<?php endwhile;
}
add_action( ‘bp_directory_groups_item’, ‘my_group_loop_activity_item’ );
?>`
I also added this to the default.css to give me a little more control of the output (changed the div in the original to match below):
` ul.item-list li div.item-descb {
margin: 10px 0 0 64px;
font-size: 11px;
color: #888;
width: 85%;
}
`
THANKS AGAIN! Here is a pict completed:
http://mustech.net/holder/grouptopic2.jpg