User favorites and user mentions feed / loop
-
Hi all,
I’m attempting to have nav tabs in the standard buddybar that displays the feed/loop for Favorites and Mentions, as seen in the pic on this page:
1. I’ve managed to duplicate the activity loop on a tab with the code below, but the CSS is wrong. I’ve fiddled with the code a little as it was originally setup for blog posts and i think this is the reason the CSS i’ve written for activity loop isn’t being called. Is the hook my_profile_post() where the issue lies?
2. I’m fine with setting up the navs and subnavs as desired, but I’m still being unsuccessful in loading a user favorites and user mentions feed/loop (want to duplicate what is shown on the subnav tabs under the default activity tab). Looked through the Buddypress code files and found and tried various things but none have worked. Any help/directions?
(Code below thanks to Dan and Henry here: https://buddypress.org/support/topic/calling-a-post-authors-activity-stream/)
function bpfr_post_profile_setup_nav() { global $bp; $parent_slug = 'test'; $child_slug = 'posts_sub'; //Add nav item bp_core_new_nav_item( array( 'name' => __( 'TEST' ), 'slug' => $parent_slug, 'screen_function' => 'bpfr_profile_post_screen', 'position' => 100, 'default_subnav_slug' => $child_slug ) ); //Add subnav item bp_core_new_subnav_item( array( 'name' => __( 'SUBTEST' ), 'slug' => $child_slug, 'parent_url' => $bp->loggedin_user->domain . $parent_slug.'/', 'parent_slug' => $parent_slug, 'screen_function' => 'bpfr_profile_post_screen' ) ); } function bpfr_profile_post_screen() { add_action( 'bp_template_content', 'bpfr_profile_post_screen_content' ); bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) ); } function bpfr_profile_post_screen_content() { do_action( my_profile_post); } add_action( 'bp_setup_nav', 'bpfr_post_profile_setup_nav' ); function bpfr_get_stuff() { $activity_id = bp_activity_get_activity_id( array( 'user_id' => bp_loggedin_user_id(), //'component' => $bp->activity->id, //'item_id' => get_current_activity_id(), //'type' => 'activity_comment', //'secondary_item_id' => $post->ID, //'type' => $activity_post_object->action_id, ) ); if ( ! $activity_id ) { return ''; } // this is the activity loop, with some options. if ( bp_has_activities( $activity_id . '&action=activity_update&max=5' ) ) : while ( bp_activities() ) : bp_the_activity(); bp_get_template_part( 'activity/entry'); endwhile; endif; } add_action ( 'my_profile_post', 'bpfr_get_stuff' );
bp 2.2.3.1
wp 4.1.2
Website is being created locally, not online.
- The topic ‘User favorites and user mentions feed / loop’ is closed to new replies.