Hello Mwale,
Thanks for posting here. Use the following code to print the total number of groups current user is a member of or you can say the user has joined.
function buddydev_print_user_total_groups() { if ( ! is_user_logged_in() ) { return ''; } $groups = groups_get_groups( array( 'user_id' => get_current_user_id(), ) ); if ( empty( $groups ) ) { return ''; } ob_start(); echo 'Total Joined Groups: ' . $groups['total']; return ob_get_clean(); } add_shortcode( 'buddydev_user_total_groups', 'buddydev_print_user_total_groups' );
Put this code into your ‘bp-custom.php’ file and use shortcode [buddydev_user_total_groups]
Thanks
Ravi
Viewing 4 posts - 1 through 4 (of 4 total)
The topic ‘ [Resolved] Display total number groups of the logged in user’ is closed to new replies.
This topic is: resolved