function sfhiv_group_has_members($ID = false) { $users = sfhiv_group_get_members($ID); if (count($users) > 0) { return true; } return false; }
function sfhiv_group_page_list_group_members() { if (!is_singular('sfhiv_group')) { return; } if (sfhiv_group_has_members()) { $users = sfhiv_group_get_members(); ?> <section id="members" class="list"> <h2 class="list-title">Members</h2> <?php $groupings = array(); foreach ($users as $user) { if (p2p_get_meta($user->p2p_id, 'group', true)) { $name = p2p_get_meta($user->p2p_id, 'group', true); if (!isset($groupings[$name])) { $groupings[$name] = array(); } array_push($groupings[$name], $user); } else { include locate_template('list-member.php'); } } foreach ($groupings as $title => $users) { echo '<h3 class="list-title">'; _e($title, 'sfhiv_theme'); echo '</h3>'; foreach ($users as $user) { include locate_template('list-member.php'); } } ?> <br class="clear" /> </section><!-- #members --> <?php } }