This function has been deprecated. bbp_make_clickable() instead.

bbp_mention_filter( $content = '' )

Finds and links @-mentioned users in the content

Description

Return

(string) $content Content filtered for mentions

Source

File: bp-forums/core/functions.php

336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
function bbp_mention_filter( $content = '' ) {
 
    // Get Usernames and bail if none exist
    $usernames = bbp_find_mentions( $content );
    if ( empty( $usernames ) )
        return $content;
 
    // Loop through usernames and link to profiles
    foreach ( (array) $usernames as $username ) {
 
        // Skip if username does not exist or user is not active
        $user = get_user_by( 'slug', $username );
        if ( empty( $user->ID ) || bbp_is_user_inactive( $user->ID ) )
            continue;
 
        // Replace name in content
        $content = preg_replace( '/(@' . $username . '\b)/', sprintf( '<a href="%1$s" rel="nofollow">@%2$s</a>', bbp_get_user_profile_url( $user->ID ), $username ), $content );
    }
 
    // Return modified content
    return $content;
}

Changelog

Changelog
Version Description
2.6.0 bbp_make_clickable()
bbPress (r4323) 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.