Skip to content

Instantly share code, notes, and snippets.

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