Hi dears
I used this code to show author avatar in both article page and article preview page (section page).
PHP Code:
require_once(DIR . '/includes/functions_user.php');
$avatarurl = fetch_avatar_url($this->content->getUserId());
if ($avatarurl[0]) {
$avatarurl = $avatarurl[0];
}
/* render template and register variables */
vB_Template::preRegister('vbcms_content_article_page',array('avatarurl' => $avatarurl));
vB_Template::preRegister('vbcms_content_article_preview',array('avatarurl' => $avatarurl));
I use the hook vbcms_article_populate-end and it works great in article page, but it show the same avatar for all authors in section page, any suggestion to make it works right in section page?
this is the code I use in the templates.
HTML Code:
<img class="cms_article_preview_image" src="{vb:raw avatarurl}" alt="{vb:raw $authorname}">