Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display all BuddyPress group id as a dropdown


  • Prabin
    Participant

    @prabin04

    Hi there,

    I want to display all the id’s of buddypress group as a drop-down in admin end.
    I know it is possible but rather than using mysql query, is there any code to display all group
    ids’ ?

    Thankx in advance

Viewing 2 replies - 1 through 2 (of 2 total)

  • danbp
    Moderator

    @danbp

    see in bp-groups-admin.php:165


    Prabin
    Participant

    @prabin04

    I did it .. thanx for reply anyway 😀

    <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>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display all BuddyPress group id as a dropdown’ is closed to new replies.
Skip to toolbar