Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Get group by creator_id?

@modemlooper

Moderator

There isn’t a function for that so you will have to access the database and get the info

place this in bp-custom.php

 

function bp_group_creator_groups( $user_id ) {

   global $wpdb;

   $groups = $wpdb->get_results( $wpdb->prepare( "SELECT name FROM wp_bp_groups WHERE creator_id = %d", $user_id ) );

   foreach ( $groups as $group ) {

     echo  '<li>' . $group->name . '</li>';

   }

}

 

then you can use this in your theme template. you will need to replace $user_id with the author of the custom posts type.

`<?php bp_group_creator_groups( $user_id ); ?>`

Skip to toolbar