Hello Tosin,
Thank you for posting. Please look at the following reference for following:
// Adding new members directory tab.
https://github.com/r-a-y/buddypress-followers/blob/master/_inc/users/hooks.php#L556// Scoping for following.
https://github.com/r-a-y/buddypress-followers/blob/master/_inc/users/hooks.php#L662Please let me know if you need further assistance.
Regards
RaviI added the code below to my bp-custom.php file but my site crashed
/** * Add a "Following (X)" tab to the members directory. * * This is so the logged-in user can filter the members directory to only * users that the current user is following. * * @uses bp_follow_total_follow_counts() Get the following/followers counts for a user. */ function bp_follow_add_following_tab() { if ( ! is_user_logged_in() ) { return; } $count = bp_follow_get_the_following_count(); if ( empty( $count ) ) { return; } ?> <li id="members-following"><a href="<?php echo bp_loggedin_user_domain() . BP_FOLLOWING_SLUG ?>"><?php printf( __( 'Following <span>%d</span>', 'buddypress-followers' ), esc_html( $count ) ) ?></a></li> <?php } add_action( 'bp_members_directory_member_types', 'bp_follow_add_following_tab' );
Yeah I finally got it, thanks for making me brainstrom
/** * Add a "Followers (X)" tab to the members directory. * * This is so the logged-in user can filter the members directory to only * users that the current user is following. * * @uses bp_follow_total_follow_counts() Get the following/followers counts for a user. */ function bpfollow_add_followers_tab() { if ( ! is_user_logged_in() ) { return; } $count = bp_follow_get_the_followers_count(); if ( empty( $count ) ) { return; } ?> <li id="members-followers"><a href="<?php echo bp_loggedin_user_domain() . BP_FOLLOWERS_SLUG ?>"><?php printf( __( 'My Followers <span>%d</span>', 'buddypress-followers' ), esc_html( $count ) ) ?></a></li> <?php } add_action( 'bp_members_directory_member_types', 'bpfollow_add_followers_tab' );
It did not work
function bpfollow_add_followers_tab() { if ( ! is_user_logged_in() ) { return; } $count = bp_follow_get_the_followers_count(); if ( empty( $count ) ) { return; } ?> <li id="members-followers"><a href="<?php echo bp_loggedin_user_domain() . BP_FOLLOWERS_SLUG ?>"><?php printf( __( 'My Followers <span>%d</span>', 'buddypress-followers' ), esc_html( $count ) ) ?></a></li> <?php } add_action( 'bp_members_directory_member_types', 'bpfollow_add_followers_tab', 999 );
The topic ‘ [Resolved] Display followers tab in members directory’ is closed to new replies.
This topic is: resolved