![]() |
Showing an avatar in the CMS
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. |
Where exactly does the avatar need to show? Show us what you have tried, and what you found but is outdated.
|
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:
|
I got it to work by using this as the plugin code:
Code:
require_once(DIR . '/includes/functions_user.php'); |
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 |
Quote:
Code:
vbcms_content_article_page Code:
vbcms_content_article_preview |
I just placed it where they spit out the authors name:
HTML Code:
<vb:if condition="$showuser"> |
Hmm, its still not working. Do i have to enable something?
|
Quote:
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}!=""> --------------- Added [DATE]1337102888[/DATE] at [TIME]1337102888[/TIME] --------------- This worked, sorry I asked my question too soon: Code:
<vb:if condition="$avatarurl != ''"> |
You could probably also just use this instead:
Code:
<vb:if condition="$avatarurl"> |
It still does not work and I have no idea why. I'm not sure what I'm doing wrong. I tried the codes you guys gave, but still no luck.
Although thanks for all the help, this is a really great community for good software. |
You need to post a link to your page where it is not working and then post *exactly* (copy/paste it) what you have done and please use code tags when you do so.
|
Quote:
So what i have done so far is follow the instructions on the site to make the plugin and instead of using his code I used yours. And since I want this to go in preview I used lewisforlife code to change it. Code:
require_once(DIR . '/includes/functions_user.php'); Code:
<vb:if condition="$showuser OR $showpublishdate OR ($showupdated AND $lastupdated) OR ($viewcount AND $showviewcount) OR ($showrating AND $rating!='')"> |
As it says in the original article, you cannot have the condition (if(self::VIEW_PAGE == $viewtype)) around the code if you need it for the preview page.
|
Thank You this is wonderful
|
I used the coding below and I'm getting nothing showing up. My site (adult related)
Quote:
Quote:
|
Try removing the condition around that template code and see if it shows up. Also, you are editing the style that you are using, right?
|
Quote:
Code:
<vb:if condition="$showuser"> Code:
<img src="{vb:raw avatarurl}" alt="Author Avatar" /> Still doesn't give me an avatar :( |
If it still doesn't give you an avatar, then you either have it inside another condition that isn't allowing it to display or you are editing the wrong template or wrong style template.
|
I'm in the vbcms_content_article_page template.
Going to the top of the code, this is what it has. Am I putting the Author avatar stuff in the wrong place? Code:
{vb:raw css} |
It is between <vb:comment> tags which means it won't show. You need to remove those comment tags.
|
That fixed it. Thank you for being patient and helpful!
One more question, how would I edit it so that the image aligns to the left of the the author name, date, etc ? |
Can you tell me what I need to edit in the CSS so that the avatar aligns up to the left of the username and publishing info.
|
I'd need to see the page and view it using firebug to be able to write some CSS.
|
<a href="http://www.swingersboard.com/forums/content/1159-don-t-wallflower-pt-4-approach.html" target="_blank">http://www.swingersboard.com/forums/...-approach.html</a> (*this site contains adult content)
|
You are going to have to rewrite parts of that template to do that. You can't just add some simple CSS to make it how you want. You'd want to throw the image into the "class="fullwidth"" div and float it left. After that you should be able to play with the other CSS to get things to lineup how you want.
|
All times are GMT. The time now is 02:17 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|