Warning: This function has been deprecated. bbp_make_clickable() instead.
bbp_mention_filter( $content = '' )
Finds and links @-mentioned users in the content
Description Description
Return Return
(string) $content Content filtered for mentions
Source Source
File: includes/core/functions.php
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; } // Link $profile_url = bbp_get_user_profile_url( $user->ID ); $profile_link = sprintf( '<a href="%1$s">@%2$s</a>', esc_url( $profile_url ), esc_html( $username ) ); $no_followed = bbp_rel_nofollow( $profile_link ); $pattern = "/(@{$username}\b)/"; // Replace name in content $content = preg_replace( $pattern, $no_followed, $content ); } // Return modified content return $content; }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | bbp_make_clickable() |
2.2.0 | Introduced. |