admin管理员组文章数量:1389783
How to get users already joined group count by user-id or username in BuddyPress.
For example,
In the member listing page, in the members loop, I like to get users group count and display in the grid.
How to get users already joined group count by user-id or username in BuddyPress.
For example,
In the member listing page, in the members loop, I like to get users group count and display in the grid.
Share Improve this question asked Mar 2, 2020 at 22:19 Gnanasekaran LoganathanGnanasekaran Loganathan 1216 bronze badges1 Answer
Reset to default 0To get the group count, use groups_get_user_groups
.
Find it in: buddypress\bp-groups\bp-groups-functions.php
In the members loop, the member id is provided via: bp_member_user_id()
You will need to check the member-loop template to find out how to hook into the loop. Or overload that template in your child theme and add a do_action
wherever you want it.
Once you have a hook, use it to call something like this:
function get_group_count_for_member() {
$groups_for_member = groups_get_user_groups( bp_member_user_id() );
echo 'Groups: ' . $groups_for_member['total'];
}
本文标签: users joined group count in buddypress
版权声明:本文标题:users joined group count in buddypress 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744693012a2620108.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论