User info pane (image)

Stimo

Active member
Was wondering if it was possible to have an image display in the user info pane left of posts. Basically on vBulletin there was a mod to have your national flag display, so basically when you selected the word 'England' it would display the English flag in the info pain.. I basically want to do the same again but not national flags this time.

Anyone have a code for it?
 
Thanks but how do i set this up in custom fields aswell? How would this code fetch the specific image to match the word selected. Sorry im not good with this.
 
You define the location in the img tag. For example:

Rich (BB code):
<xen:if is="{$user.customFields.field_id}">
<img src="images/flags/{$user.customFields.field_id}.gif" width=35 height=25 border="0" alt="{$user.customFields.field_id}">
</xen:if>

In this code the image location is:

images/flags/{$user.customFields.field_id}.gif

The value of the profile field is used as the name of the image.
 
Hmm didn't seem to work

infoimage.png
 
With a beginning slash it becomes an absolute web path meaning it will always look to your web root instead of the forum root. If the "images" directory is in the forum root then you should use a relative location (no beginning slash).
 
Then check the page source to see the img src to make sure the location is showing correctly on the rendered page. Or right click the image on the page and get properties to see the location.
 
is this code suppose to replace another code?

Nope. Just put it in the message_user_info template where you want the image to show.

Did you check the page source and image location? Is the img tag even showing in the page source? You just need to debug it to make sure everything is outputting correct.
 
I checked the page source and can't find the code, and i can't do image location as the image isnt showing, it should be where the word McLaren is.
 
Looks fine to me. Some possibilities:

1) Your user has not filled in that field on the profile page:

http://xenforo.com/community/account/personal-details

2) The field_id (f1team) is incorrect.

3) You are viewing a different style than you are editing.

You can debug that profile field by adding that variable to the top of the template:

Code:
output = {$user.customFields.f1team}

That will allow you to see what the value is to make sure it is what you expect.
 
Looks fine to me. Some possibilities:

1) Your user has not filled in that field on the profile page:

http://xenforo.com/community/account/personal-details

2) The field_id (f1team) is incorrect.

3) You are viewing a different style than you are editing.

You can debug that profile field by adding that variable to the top of the template:

Code:
output = {$user.customFields.f1team}

That will allow you to see what the value is to make sure it is what you expect.

1) The user im testing on is myself, and i have filled out the field with 'McLaren' which is named the same as the image.

2) I have checked a few times now and i really believe the id is f1team.

3) How would i check if im doing the right style? even though im sure i am.

Do i put this debug code at the top of the 'message_user_info' template? And where will it display the value when done so i can check?
 
Ah, it's showing the value instead of the text. That depends on the type of field. Try using this:

Code:
{xen:helper userFieldValue, {$userFieldsInfo.f1team}, $user, {$user.customFields.f1team}}

In place of:

Code:
{$user.customFields.f1team}
 
Top Bottom