• Resolved benrellick

    (@benrellick)


    Hi all, first time posting. Really excellent plugin, I love it, but I’m having a bit of trouble. I’d like to link to a page displaying all of the users that you’re following. Preferably just a permalink to the “following” tab on the /members/ page. The problem is that it seems like it’s using ajax to load those members, and I’m not sure how to override that so that it always shows ONLY the people that you’re following.

    Currently I just created a page template with the contents of members/index.php and members/members-loop.php and modified the members loop as such:
    <?php if ( bp_has_members( 'include=' . bp_get_following_ids() ) ) : ?>

    I could also link to /members/USERNAME/following/, but in that case I’d want to use CSS to hide the header content somehow since I’d prefer to only display the list of followers.

    Any idea of the simplest way to do this? Am I on the right track at least? Any help would be very much appreciated. Thanks!

    https://www.ads-software.com/plugins/buddypress-followers/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author r-a-y

    (@r-a-y)

    @benrellick – You have the right idea by creating your own custom members loop or by linking to the member’s own following page.

    You could also use the built-in widget that comes with BP Follow, but that widget only shows users that the logged-in user is following. Take a look at the code in bp-follow-widgets.php for some inspiration.

    Hope that helps!

    Thread Starter benrellick

    (@benrellick)

    Thanks r-a-y, looking in bp-follow-widgets.php did help. In case anybody else has the same question, here’s what ended up working for me:

    <?php if ( bp_has_members( 'include=' . bp_get_following_ids( array( 'user_id' => bp_loggedin_user_id() ) ) ) ) : ?>

    I noticed that users I had manually added were still not showing up in the loop since their last activity displayed as “Never Active,” so I got around that with this snippet, which I’m not 100% sure of, but I think it did the trick. It looks for users with the role of author that have never been active and sets last_activity to the current time, but theoretically should only have to do this once.

    global $wpdb;
    		foreach ( $wpdb->get_col( "SELECT ID FROM $wpdb->users" ) as $user_id ) {
    			$last_activity = bp_get_user_last_activity( $user_id );
    			if ( user_can( $user_id, "author" ) && $last_activity == '' ) {
    				bp_update_user_last_activity( $user_id, bp_core_current_time() );
    			};
    		};

    Uses bp_update_user_last_activity which only works in Buddypress 2.0

    Plugin Author r-a-y

    (@r-a-y)

    Cool, glad that worked for you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Permalink for Followers in Member loop’ is closed to new replies.