How to display only members of a specific group?
-
Hello guys,
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> <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>"; $n++; }
Is it possible to display the $username of the users that are only members of two specific groups?
bp-groups&gid=2 and bp-groups&gid=5Thanks in advance 🙂
EDIT:
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 ) )
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.