Changeset 2218 for trunk/bp-activity/bp-activity-filters.php
- Timestamp:
- 12/27/2009 08:01:21 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/bp-activity/bp-activity-filters.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-filters.php
r2168 r2218 55 55 } 56 56 57 function bp_activity_at_name_filter( $content ) { 58 include_once( ABSPATH . WPINC . '/registration.php' ); 59 60 $pattern = '/[@]+([A-Za-z0-9-_]+)/'; 61 preg_match_all( $pattern, $content, $usernames ); 62 63 /* Make sure there's only one instance of each username */ 64 if ( !$usernames = array_unique( $usernames[1] ) ) 65 return $content; 66 67 foreach( (array)$usernames as $username ) { 68 if ( !username_exists( $username ) ) 69 continue; 70 71 $content = str_replace( "@$username", "<a href='" . bp_core_get_user_domain( bp_core_get_userid( $username ) ) . "' rel='nofollow'>@$username</a>", $content ); 72 } 73 74 return $content; 75 } 76 add_filter( 'xprofile_activity_new_update_content', 'bp_activity_at_name_filter' ); 77 add_filter( 'groups_activity_new_update_content', 'bp_activity_at_name_filter' ); 57 78 58 79 ?>
Note: See TracChangeset
for help on using the changeset viewer.