Skip to content

Instantly share code, notes, and snippets.

@GLWalker
Created November 23, 2021 05:14
Show Gist options
  • Save GLWalker/e20c5dede1015c8ea473c6d9cbb7912d to your computer and use it in GitHub Desktop.
Save GLWalker/e20c5dede1015c8ea473c6d9cbb7912d to your computer and use it in GitHub Desktop.
BuddyPress Group Admin's Output with Boostrap 5 css classes
/**
* Output markup listing group admins.
*
* @since 1.0.0
*
* @param object|bool $group Optional. Group object.
* Default: current group in loop.
*/
function systmp_bp_group_list_admins($group = false)
{
global $groups_template;
if (empty($group)) {
$group = &$groups_template->group;
}
if (!empty($group->admins)) { ?>
<ul id="group-admins" class="d-flex list-unstyled mt-auto">
<?php foreach ((array) $group->admins as $admin) { ?>
<li class="m-2">
<a href=" <?php echo bp_core_get_user_domain($admin->user_id, $admin->user_nicename, $admin->user_login) ?>" data-bs-toggle="tooltip" title="<?php printf(('%s'), bp_core_get_user_displayname($admin->user_id)); ?>" aria-label="<?php printf(('%s'), bp_core_get_user_displayname($admin->user_id)); ?>">
<?php
echo bp_core_fetch_avatar(
array(
'item_id' => $admin->user_id,
'email' => $admin->user_email,
'class' => 'rounded border border-1',
'alt' => sprintf(
/* translators: %s: member name */
__('Profile picture of %s', 'buddypress'),
bp_core_get_user_displayname($admin->user_id)
),
)
);
?>
</a>
</li>
<?php } ?>
</ul>
<?php } else { ?>
<span class="activity"><?php _e('No Admins', 'buddypress') ?></span>
<?php }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment