BP_Email_Tokens::token__group_description( BP_Email $bp_email, array $formatted_tokens, array $tokens )

Generate the output for token group.description

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

1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
public function token__group_description( $bp_email, $formatted_tokens, $tokens ) {
    $group_id = false;
    $output = '';
 
    if ( ! bp_is_active( 'groups' ) ) {
        return '';
    }
 
    $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 );
    }
 
    $group_excerpt = bp_get_group_description_excerpt( $group );
 
    if ( empty( $group ) || empty( $group_excerpt ) ) {
        return $output;
    }
 
    $settings = bp_email_get_appearance_settings();
 
    ob_start();
    ?>
    <div class="spacer" style="font-size: 5px; line-height: 5px; height: 5px;">&nbsp;</div>
    <table cellspacing="0" cellpadding="0" border="0" width="100%"
            style="background: <?php echo esc_attr( $settings['quote_bg'] ); ?>; border: 1px solid <?php echo esc_attr( $settings['body_border_color'] ); ?>; border-radius: 4px; border-collapse: separate !important">
         <tbody>
            <tr>
                <td height="5px" style="font-size: 5px; line-height: 5px;">&nbsp;</td>
            </tr>
            <tr>
                <td align="center">
                    <table cellpadding="0" cellspacing="0" border="0" width="88%" style="width: 88%;">
                        <tbody>
                            <tr>
                                <td>
                                    <div style="color: <?php echo esc_attr( $settings['body_text_color'] ); ?>; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: <?php echo esc_attr( $settings['body_text_size'] . 'px' ); ?>; letter-spacing: -0.24px; line-height: <?php echo esc_attr( floor( $settings['body_text_size'] * 1.625 ) . 'px' ) ?>;">
                                        <?php echo wpautop( $group_excerpt ); ?>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td height="5px" style="font-size: 5px; line-height: 5px;">&nbsp;</td>
            </tr>
         </tbody>
    </table>
    <div class="spacer" style="font-size: 30px; line-height: 30px; height: 30px;">&nbsp;</div>
    <?php
    $output = str_replace( array( "\r", "\n" ), '', ob_get_clean() );
 
    return $output;
}

Changelog

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.