1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-21 05:02:02 +02:00

Added {{NEWS_AUTHOR_EUF} to retrieve User Extended Fields from news author

This commit is contained in:
Tijn Kuyper 2019-05-20 22:30:46 +02:00
parent 7839e49021
commit 4ed4ff8035
No known key found for this signature in database
GPG Key ID: AAEA3CC2C5A308F2

View File

@ -336,6 +336,22 @@ class news_shortcodes extends e_shortcode
return e107::getUrl()->create('news/list/author',array('author'=>$this->news_item['user_name'])); // e_BASE."news.php?author=".$val
}
/**
* @example {NEWS_AUTHOR_EUF: field=biography} - returns the 'value' of the User Extended Field 'biography' ('type' defaults to 'value')
* @example {NEWS_AUTHOR_EUF: field=biography&type=icon} - returns the 'icon' of the User Extended Field 'biography' - [text|value|icon|text_value]
*/
public function sc_news_author_euf($parm=null)
{
$userid = $this->news_item['user_id'];
$field = (!empty($parm['field'])) ? $parm['field'] : '';
$type = (!empty($parm['type'])) ? $parm['type'] : 'value';
if($field)
{
return e107::getParser()->parseTemplate("{USER_EXTENDED={$field}.{$type}.{$userid}}");
}
}
public function sc_news_summary($parm=null)
{
return $this->sc_newssummary($parm);