[insert_php] echo ‘[‘;
global $wpdb;
$utilcomma=””;
$maxgroupid=1;
$groups = $wpdb->get_results( $wpdb->prepare( “SELECT name, id, slug FROM wp_bp_groups”,””) );
foreach ( $groups as $group ) {
echo $utilcomma.'{"groupid":’.$group->id.’,"groupname":"’.$group->name.’","groupslug":"’.$group->slug.’"}’;
if($group->id > $maxgroupid) {$maxgroupid=$group->id;}
$utilcomma=”,”;}
echo $utilcomma.'{"groupid":’.($maxgroupid+1).’,"groupname":"launch","groupslug":"launch"}]’;
[/insert_php]