bbp_convert_mentions( string $data )
Convert mentions into links
Description
Parameters
- $data
-
(Required) Content to convert mentions
Return
(string) Filtered content
Source
File: bp-forums/common/formatting.php
function bbp_convert_mentions( $data ) { // Search mentions in the content. $usernames = bp_find_mentions_by_at_sign( array(), $data ); // We have mentions! if ( ! empty( $usernames ) ) { foreach ( (array) $usernames as $user_id => $username ) { $data = preg_replace( '/(@' . $username . '\b)/', "<a class='bp-suggestions-mention' href='" . bbp_get_user_profile_url( $user_id ) . "' rel='nofollow'>@$username</a>", $data ); } // Temporary variable to avoid having to run bp_find_mentions_by_at_sign() again. buddypress()->forums->mentioned_users = $usernames; } return $data; }
Changelog
Version | Description |
---|---|
BuddyBoss 1.2.8 | 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.