Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

buddypress groups dropdown

<div>
    <?php global $bp,$wpdb;
        $group_id = get_post_meta( $post->ID, 'campaign_group_id', true );
            $group_results = $wpdb->get_results("SELECT id,name FROM {$wpdb->prefix}bp_groups ORDER BY ID ASC");
            ?>
                <label for="meta-box-dropdown">ADD/EDIT</label>
                    <select name="meta-box-dropdown">
                    <?php foreach($group_results as $group_result): ?>
                <option <?php echo  ($group_id==$group_result->id)?"selected=selected":"" ?> value="<?php echo $group_result->id ?>"><?php echo $group_result->name ?></option>
        <?php   endforeach; ?>  
    </select>
    <br>
</div>
Source by buddypress.org #
 
PREVIOUS NEXT
Tagged: #buddypress #groups #dropdown
ADD COMMENT
Topic
Name
2+2 =