Forum Replies Created
-
I figured it out! Please ignore or close topic.
Thank you.
I’m trying to insert the code into a template page within my site that I created, by referencing bbp. I’m trying to take this out of the bbp template file. However, the code isn’t recognizing the current user..
Hmm.. there is the following code that looks suspect in the plugin:
/* Fetch an existing activity_id if one exists. */ if ( function_exists( 'bp_activity_get_activity_id' ) ) $id = bp_activity_get_activity_id( array( 'user_id' => false, 'action' => $activity_action, 'component' => $bp->groups->id, 'type' => 'exb', 'item_id' => $group_id, 'secondary_item_id' => wp_hash( $post['blogurl'] ) ) );
Anything here stand out as a possibility?
Also, regarding the thumbnail integration, I’ve been trying to figure out what the necessary fetching rules are to gather that data? The below is clearly where it goes, I just have no clue how to properly integrate this..
/* Set the visibility */ $hide_sitewide = ( 'public' != $group->status ) ? true : false; foreach ( (array) $group_blogs as $feed_url ) { $rss = fetch_feed( trim( $feed_url ) ); if (!is_wp_error($rss) ) { $maxitems = $rss->get_item_quantity( 10 ); $rss_items = $rss->get_items( 0, $maxitems ); foreach ( $rss_items as $item ) {; $key = $item->get_date( 'U' ); $items[$key]['title'] = $item->get_title(); $items[$key]['subtitle'] = $item->get_title(); //$items[$key]['author'] = $item->get_author()->get_name(); $items[$key]['blogname'] = $item->get_feed()->get_title(); $items[$key]['link'] = $item->get_permalink(); $items[$key]['blogurl'] = $item->get_feed()->get_link(); $items[$key]['description'] = $item->get_description(); $items[$key]['source'] = $item->get_source(); $items[$key]['copyright'] = $item->get_copyright(); } } } if ( $items ) { ksort( $items ); $items = array_reverse( $items, true ); } else { return false; } /* Record found blog posts in activity streams */ foreach ( (array) $items as $post_date => $post ) { $activity_action = sprintf( __( '%s from %s in %s', 'bp-groups-externalblogs' ), '<a class="feed-link" href="' . esc_attr( $post['link'] ) . '" target="_blank">' . esc_attr( $post['title'] ) . '</a>', '<a class="feed-author" href="' . esc_attr( $post['blogurl'] ) . '" target="_blank">' . attribute_escape( $post['blogname'] ) . '</a>', '<a href="' . bp_get_group_permalink( $group ) . '">' . attribute_escape( $group->name ) . '</a>' ); $activity_content = '<div>' . strip_tags( bp_create_excerpt( $post['description'], 175 ) ) . '</div>'; $activity_content = apply_filters( 'bp_groupblogs_activity_content', $activity_content, $post, $group ); /* Fetch an existing activity_id if one exists. */ if ( function_exists( 'bp_activity_get_activity_id' ) ) $id = bp_activity_get_activity_id( array( 'user_id' => false, 'action' => $activity_action, 'component' => $bp->groups->id, 'type' => 'exb', 'item_id' => $group_id, 'secondary_item_id' => wp_hash( $post['blogurl'] ) ) ); /* Record or update in activity streams. */ groups_record_activity( array( 'id' => $id, 'user_id' => false, 'action' => $activity_action, 'content' => $activity_content, 'primary_link' => $item->get_link(), 'type' => 'exb', 'item_id' => $group_id, 'secondary_item_id' => wp_hash( $post['blogurl'] ), 'recorded_time' => gmdate( "Y-m-d H:i:s"), 'hide_sitewide' => $hide_sitewide ) ); } return $items; }
Thanks. Unfortunately that specific change of code ignored the avatar completely and just removed the heading. See below for reference:
Before:
After:
Correct. It currently just clicks out to the article it’s feeding.