Buddypress followers plugin
How can I include the number of followers and following on my profile header such as Twitter? I know the number is displayed on the tags Followers(*) and Following(*) but is there a way to display those for example underneath your Profile name?
bp_follow_total_follow_counts ( ) – where default arg ‘user_id’ => $bp->loggedin_user->id
returns an array with followers and following
thanks @nuprn1 but how will I place it underneath my name in my profile?
couple of action hooks on member-header.php
bp_before_member_header_meta is underneath the name/last active
@nuprn1 – I have placed bp_follow_total_follow_counts ($bp->loggedin_user->id); underneath bp_before_member_header_meta but it doesn’t display anything
I wanted something similar, this works for me (rich may have better take on it though also didn’t someone write a stats plugin , seems these following items would sit nicely in that output?)
Dropped into functions.php:
oh right member profile stats plugin i could add following/er/friends to the mix (think i left it off since the info is duplicated on the nav items)
😆 I just tried
I did hesitate wondering if it was useful to have it in stats block in header as well as the nav items below. at the moment that little functions squirts followers/following directly beneath the stats output for me.
Can you not use that function I posted up to help out? If not @nuprn1 will have an alternative and probably better approach.
It has to be this:
bp_follow_total_follow_counts( array( ‘user_id’ => $id ) );
Change $id to whatever.
Change ‘loggedin_user’ to ‘displayed_user’
I was originally using displayed_user changed to loggedin_user but realised it wasn’t the result I wanted.
Thanks for all the help guys. It works @hnla
i would contact Andy if his plugin is causing a conflict.
@nuprn1, @r-a-y, @hnla – another problem. If you were following a member and they were marked as a spammer by the admin of the site, your following count still displays the same number but when viewing the “following” page it only displays the ones that are not marked as spam. To give you an example. I were following 23 people. I marked one of those as a spammer. It still displays 23 on my following count but when I view the “following” page it displays – “
Viewing member 1 to 20 (of 22 active members)” Is there anyway that the count following and followers will not take spammers?
In a word? Yes! Doing so is really the purview of the plugin developer? I would have though it’s a simple check that a member is not equal to whatever the field is that marks someone as a spammer however and not having looked at the plugin it sounds as though a table is built up of follwers but that isn’t rechecked against possible changes to those members, essentially you add a member as a follower and remove a member as a follower but nothing happens in-between.
I deleted those users id’s manually out of the bp_follow table
quickly glancing over the follower’s plugin code – i don’t see anything that hooks like how the friends component does
add_action( 'wpmu_delete_user', 'friends_remove_data' );
add_action( 'delete_user', 'friends_remove_data' );
add_action( 'make_spam_user', 'friends_remove_data' );
Maybe someone should provide an alternative version for this plugin as a stop-gap until Andy is ready to resume duties with BP-related matters?
- The topic ‘Buddypress followers plugin’ is closed to new replies.