for non-post items (e.g. photos, events, whatever) add mention tags explicitly to the output rendering since they may not be present in the post body.
This commit is contained in:
parent
96ab09a267
commit
8a84718163
@ -1237,6 +1237,27 @@ function format_hashtags(&$item) {
|
||||
|
||||
|
||||
|
||||
function format_mentions(&$item) {
|
||||
|
||||
$s = '';
|
||||
$terms = get_terms_oftype($item['term'],TERM_MENTION);
|
||||
if($terms) {
|
||||
$categories = array();
|
||||
foreach($terms as $t) {
|
||||
$term = htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8',false) ;
|
||||
if(! trim($term))
|
||||
continue;
|
||||
if(strpos($item['body'], $t['url']))
|
||||
continue;
|
||||
|
||||
if($s)
|
||||
$s .= ' ';
|
||||
|
||||
$s .= '@<a href="' . zid($t['url']) . '" >' . $term . '</a>';
|
||||
}
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
function format_filer(&$item) {
|
||||
@ -1293,6 +1314,10 @@ function prepare_body(&$item,$attach = false) {
|
||||
|
||||
$s .= format_hashtags($item);
|
||||
|
||||
if($item['resource_type'])
|
||||
$s .= format_mentions($item);
|
||||
|
||||
|
||||
$s .= format_categories($item,$writeable);
|
||||
|
||||
if(local_user() == $item['uid'])
|
||||
|
Reference in New Issue
Block a user