bbp_get_reply_author_email( int $reply_id )

Return the reply author email address

Description

Parameters

$reply_id

(Optional) Reply id

Return

(string) Reply author email address

Source

File: bp-forums/replies/template.php

1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
function bbp_get_reply_author_email( $reply_id = 0 ) {
    $reply_id = bbp_get_reply_id( $reply_id );
 
    // Not anonymous
    if ( !bbp_is_reply_anonymous( $reply_id ) ) {
 
        // Use reply author email address
        $user_id      = bbp_get_reply_author_id( $reply_id );
        $user         = get_userdata( $user_id );
        $author_email = !empty( $user->user_email ) ? $user->user_email : '';
 
    // Anonymous
    } else {
 
        // Get email from post meta
        $author_email = get_post_meta( $reply_id, '_bbp_anonymous_email', true );
 
        // Sanity check for missing email address
        if ( empty( $author_email ) ) {
            $author_email = '';
        }
    }
 
    return apply_filters( 'bbp_get_reply_author_email', $author_email, $reply_id );
}

Changelog

Changelog
Version Description
bbPress (r3445) 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.