The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hello
I need to add an avatar to the articles of my site on request of the authors, but everything I have tried does not work. I found something but I'm pretty sure it is outdated and does not work. So please help me out. |
|
#2
|
||||
|
||||
|
Where exactly does the avatar need to show? Show us what you have tried, and what you found but is outdated.
|
|
#3
|
|||
|
|||
|
http://thejestersgallery.com/index.php
if you take a look at the articles, I want the avatars to show above the publish information. I have tried this link for vBulletin.com How-To: Add User Avatar to CMS Articles (i thought this was outdated) This one shows a nice white box but no avatar image ive also tired this code added to and img code, with no luck PHP Code:
|
|
#4
|
||||
|
||||
|
I got it to work by using this as the plugin code:
Code:
require_once(DIR . '/includes/functions_user.php');
if(self::VIEW_PAGE == $viewtype) {
$avatarurl = fetch_avatar_url($view->authorid, true);
if ($avatarurl[0]) $avatarurl = $avatarurl[0];
/* render template and register variables */
vB_Template::preRegister('vbcms_content_article_page',array('avatarurl' => $avatarurl));
}
|
|
#5
|
|||
|
|||
|
I attempted this back in Sept 2011 and now today and the closest I get is just seeing the title Author Avatar and I have never seen the avatar image.
If anyone has a suggestion where to place the code... Code:
<img src="{vb:raw avatarurl}" alt="Author Avatar" />
Code:
vbcms_content_article_page |
|
#6
|
|||
|
|||
|
Quote:
Code:
vbcms_content_article_page Code:
vbcms_content_article_preview |
|
#7
|
||||
|
||||
|
I just placed it where they spit out the authors name:
HTML Code:
<vb:if condition="$showuser"> <img src="{vb:raw avatarurl}" alt="Author Avatar" /> <div class="article_username_container<vb:if condition="!$showrating">_full</vb:if>"> {vb:rawphrase by_x_nolink, {vb:raw memberaction_dropdown}} </div> </vb:if> |
|
#8
|
|||
|
|||
|
Hmm, its still not working. Do i have to enable something?
|
|
#9
|
|||
|
|||
|
You do have to enable the plugin by going to Plugins & Products->Plugin Manager, scroll down to your plugin and enable it.
Lynne: This is working for me, now I also want to show the avatar on the CMS preview on the home page. What are the steps that I take to register the variable to work on: vbcms_content_article_preview? Thanks. --------------- Added [DATE]1337101605[/DATE] at [TIME]1337101605[/TIME] --------------- Nevermind, this worked: Code:
vB_Template::preRegister('vbcms_content_article_preview',array('avatarurl' => $avatarurl));
--------------- Added [DATE]1337102608[/DATE] at [TIME]1337102608[/TIME] --------------- I tried this: Code:
<vb:if {vb:raw avatarurl}!="">
<br /><img src="{vb:raw avatarurl}" alt="Author Avatar" /> <br />
<vb:else />
<img src="images/misc/unknown.gif" />
</vb:if>
--------------- Added [DATE]1337102888[/DATE] at [TIME]1337102888[/TIME] --------------- This worked, sorry I asked my question too soon: Code:
<vb:if condition="$avatarurl != ''">
<br /><img src="{vb:raw avatarurl}" alt="Author Avatar" /> <br />
<vb:else />
<br /><img src="images/misc/unknown.gif" /> <br />
</vb:if>
|
| Благодарность от: | ||
| Lynne | ||
|
#10
|
||||
|
||||
|
You could probably also just use this instead:
Code:
<vb:if condition="$avatarurl">
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|