BP_Email_Tokens::token__group_card_small( BP_Email $bp_email, array $formatted_tokens, array $tokens )
Generate the output for token group.small_card
Description
Parameters
- $bp_email
-
(Required)
- $formatted_tokens
-
(Required)
- $tokens
-
(Required)
Return
(string) html for the output
Source
File: bp-core/classes/class-bp-email-tokens.php
public function token__group_card_small( $bp_email, $formatted_tokens, $tokens ) {
$output = '';
$settings = bp_email_get_appearance_settings();
$group = isset( $tokens['group'] ) ? $tokens['group'] : false;
if ( empty( $group ) ) {
$group_id = isset( $tokens['group.id'] ) ? $tokens['group.id'] : false;
if ( empty( $group_id ) ) {
return $output;
}
$group = groups_get_group( $group_id );
}
if ( empty( $group ) ) {
return $output;
}
ob_start();
?>
<table cellspacing="0" cellpadding="0" border="0" width="100%"
style="background: <?php echo esc_attr( $settings['body_bg'] ); ?>; border: 1px solid <?php echo esc_attr( $settings['body_border_color'] ); ?>; border-radius: 4px; border-collapse: separate !important">
<tbody>
<tr>
<td height="16px" style="font-size: 16px; line-height: 16px;"> </td>
</tr>
<tr>
<td align="center">
<table cellpadding="0" cellspacing="0" border="0" width="94%" style="width: 94%;">
<tbody>
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td width="20%" class="mobile-block-full">
<a class="group-avatar-wrap mobile-center" href="<?php echo bp_get_group_permalink( $group ); ?>"
style="border: 1px solid <?php echo esc_attr( $settings['body_border_color'] ); ?>; display: block; border-radius: 3px; width: 104px;">
<?php
$group_avatar = bp_core_fetch_avatar( array(
'item_id' => $group->id,
'avatar_dir' => 'group-avatars',
'type' => 'full',
'object' => 'group',
'width' => 200,
'height' => 200,
'html' => false
) );
?>
<img alt="" src="<?php echo $group_avatar; ?>" width="100" height="100" border="0"
style="margin: 2px; padding:0; box-sizing: border-box; border-radius: 3px; border: 3px solid <?php echo esc_attr( $settings['body_bg'] ); ?>; display:block;" />
</a>
</td>
<td width="4%" class="mobile-hide"> </td>
<td width="76%" class="mobile-block-padding-full">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td class="mobile-text-center">
<div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: <?php echo esc_attr( floor( $settings['body_text_size'] * 1.625 ) . 'px' ) ?>; color: <?php echo esc_attr( $settings['body_secondary_text_color'] ); ?>; line-height: <?php echo esc_attr( floor( $settings['body_text_size'] * 1.625 ) . 'px' ) ?>;"><?php echo $group->name; ?></div>
<div class="spacer" style="font-size: 3px; line-height: 3px; height: 3px;"> </div>
<p style="opacity: 0.7; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: <?php echo esc_attr( floor( $settings['body_text_size'] * 0.8125 ) . 'px' ) ?>; color: <?php echo esc_attr( $settings['body_text_color'] ); ?>; margin: 0;"><?php echo ucfirst( $group->status ) . " " . __( 'Group', 'buddyboss' ); ?></p>
</td>
</tr>
<tr>
<td height="16px" style="font-size: 16px; line-height: 16px;"> </td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="47%" style="width: 47%;" align="left" class="responsive-table mobile-text-center">
<tbody>
<tr>
<td height="34px" style="vertical-align: middle;">
<?php
$group_members_count = bp_get_group_total_members( $group );
$member_text = ( $group_members_count > 1 ) ? __('members', 'buddyboss') : __('member', 'buddyboss');
?>
<div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size: <?php echo esc_attr( floor( $settings['body_text_size'] * 0.8125 ) . 'px' ) ?>; color: <?php echo esc_attr( $settings['body_text_color'] ); ?>;">
<span style="color: <?php echo esc_attr( $settings['body_secondary_text_color'] ); ?>; opacity: 0.85;"><?php echo $group_members_count; ?></span> <?php echo $member_text; ?>
</div>
</td>
</tr>
</tbody>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="47%" style="width: 47%;" align="right" class="responsive-table">
<tbody>
<tr>
<td height="34px" align="right" style="vertical-align: middle;" class="mobile-padding-bottom">
<a class="mobile-button-center" href="<?php echo bp_get_group_permalink( $group ); ?>" target="_blank" rel="nofollow" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size: <?php echo esc_attr( floor( $settings['body_text_size'] * 0.875 ) . 'px' ) ?>;text-decoration: none;display: block;border: 1px solid <?php echo $settings['highlight_color']; ?>;border-radius: 100px;text-align: center; height: 32px;line-height: 32px;background: <?php echo $settings['highlight_color']; ?>;color: #fff !important;width: 130px;"><?php _e( 'Visit Group', 'buddyboss' ); ?></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height="16px" style="font-size: 16px; line-height: 16px;"> </td>
</tr>
</tbody>
</table>
<div class="spacer" style="font-size: 10px; line-height: 10px; height: 10px;"> </div>
<?php
$output = str_replace( array( "\r", "\n" ), '', ob_get_clean() );
return $output;
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.