1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to display only members of a specific group?

Discussion in 'WordPress' started by Divvy, Jul 19, 2021.

  1. #1
    Can someone please help me?

    I have this code:
    function jwa_get_top_dino_users( $post ){
    global $wpdb;
    $post_id = $post->ID;
    $results = $wpdb->get_results( "SELECT * FROM " . jwa_get_table_name() . " where dino_id = '$post_id' ORDER BY boost_sum DESC LIMIT 10" );
    $data = "<div class='jwa-grid-row jwa-single-post'>
    <div class='col-box-12'>
    <div class='jwa-grid-row'>
    <div class='col-box-6'>
    <img src='".get_the_post_thumbnail_url( $post, 'full' )."' class='img-box' style='float: right; margin-right: 30px;' alt='".esc_html( get_the_title( $post ) )."' />
    <div class='col-box-6 jwa-single-post-data'>
    <div class='jwa-sub-title'><strong>The most powerful ".get_the_title( $post )."</strong>:</div>";
    $n = 1;
    foreach ( $results as $key => $value ) {
    // code...
    $user_id = $value->user_id; // custom type post id
    $dino_id = $value->dino_id; // custom type post id
    $level_boost = $value->level_boost; // user levels
    $health_boost = $value->health_boost;
    $damage_boost = $value->damage_boost;
    $speed_boost = $value->speed_boost;
    // $username = bp_core_get_username( $user_id );
    $username = get_user_by( 'id', $user_id )->display_name ;
    $data .= "<div style='margin-left: 10px; padding-bottom: 5px'>$n. ".jwa_strong( $username )."</div>";
    Code (markup):
    Working with buddypress, is it possible to display the $username of the users that are only members of two specific groups?


    I have found the following code, but I don’t know how to apply:

    $this_id = bp_get_group_id();
    echo "group id is: " . $this_id; // make sure there is a value here.
    $has_members_str = "group_id=" . $this_id;
    if ( bp_group_has_members( $has_members_str ) )
    Code (markup):
    Thanks in advance :)
    Divvy, Jul 19, 2021 IP