Group Members Loop shortcode troubleshutting
-
I created a shortcode to display a list of group members, but I always get the “This group has no members” result. What is wrong here? The group with ID 2 exists and have one member.
add_shortcode( 'group_members', 'list_group_members' ); function list_group_members() { global $bp; if ( bp_group_has_members( 'group_id=2' ) ) { echo '<ul id="member-list" class="item-list">'; while ( bp_group_members() ) : bp_group_the_member(); echo '<li>'; // Example template tags you can use bp_group_member_name(); bp_group_member_avatar(); bp_group_member_link(); bp_group_member_joined_since(); echo '</li>'; endwhile; echo '</ul>'; } else { echo '<div id="message" class="info">'; echo '<p>This group has no members.</p>'; echo '</div>'; } }
- The topic ‘Group Members Loop shortcode troubleshutting’ is closed to new replies.