Commit c9e7c8e5 authored by Nigel McNie's avatar Nigel McNie
Browse files

Added a function to format the introduction of a users' profile for display in search results

parent 51930729
......@@ -1582,6 +1582,18 @@ function format_whitespace($text) {
return $text;
}
/**
* Returns only the first short snippet of a user's introduction
*/
function format_introduction($introduction) {
$introduction = strip_tags($introduction);
// Note: the lengths are different to prevent chopping off just one or two characters in order to add an ellipsis
if (strlen($introduction) < 110) {
return $introduction;
}
return substr($introduction, 0, 100) . '...';
}
/**
* Given raw text (eg typed in by a user), this function cleans it up
* and removes any nasty tags that could mess up pages.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment