buddypress groups dropdown

Solutions on MaxInterview for buddypress groups dropdown by the best coders in the world

showing results for - "buddypress groups dropdown"
Leyna
23 Jul 2019
1<div>
2    <?php global $bp,$wpdb;
3        $group_id = get_post_meta( $post->ID, 'campaign_group_id', true );
4            $group_results = $wpdb->get_results("SELECT id,name FROM {$wpdb->prefix}bp_groups ORDER BY ID ASC");
5            ?>
6                <label for="meta-box-dropdown">ADD/EDIT</label>
7                    <select name="meta-box-dropdown">
8                    <?php foreach($group_results as $group_result): ?>
9                <option <?php echo  ($group_id==$group_result->id)?"selected=selected":"" ?> value="<?php echo $group_result->id ?>"><?php echo $group_result->name ?></option>
10        <?php   endforeach; ?>  
11    </select>
12    <br>
13</div>