Welcome to vBulletin Guru!


vBulletin is arguably the best community forum software available today. vBulletin Guru is here to offer both free advice on how to successfully build, customize and manage your forum based website as well as offer advice and resources for more advanced topics of forum management such as SEO (Search Engine Optimization), community growth and monetization.
Sep
07

How-To: Add User Avatar to CMS Articles

By
Maybe a mod will move this to the Tips and Tricks forum...

The vBCMS provides a user with the functionality to customize their site to meet their needs. I understand most users would prefer to have out of the box solutions to their needs but sometimes this is not always available. Luckily for us, we have the tools necessary to do the additions we want. As I go through customizing my site, I thought I would share some of the items I have done.

Add the authors avatar to the article page


1. Create a plugin:
Product - vBulletin CMS
Hook Location - vbcms_article_populate_end (vBulletin CMS)
Title - Whatever you like
Execution Order - 1
Plugin Code:
PHP Code:

require_once(DIR '/includes/functions_user.php');
if(
$nodeid != '') {
$avatarurl fetch_avatar_url($view->authoridtrue);
if (
$avatarurl[0]) {
$avatarurl $avatarurl[0];
}
/* render template and register variables */vB_Template::preRegister('vbcms_content_article_page',array('avatarurl' => $avatarurl));


2. In the style you want to add the avatar to, edit template vbcms_content_article_page and add where you want the avatar to show:
Code:

<img src="{vb:raw avatarurl}" alt="Author Avatar" />
Important: Use my code at your own risk. I take no responsibility for any problems or data loss this may cause.

Comments are closed.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes