1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

User info pane (image)

Discussion in 'Styling and Customization Questions' started by Stimo, Jun 13, 2012.

  1. Stimo

    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?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. Stimo

    Stimo Active Member

    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.
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That template code uses the value of the profile field in the img src. Your image names / locations need to incorporate the profile field values.
     
  5. Stimo

    Stimo Active Member

    Where should i upload the images to for this code to pick them up?
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You define the location in the img tag. For example:

    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.
     
  7. Stimo

    Stimo Active Member

    Hmm didn't seem to work

    [​IMG]
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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).
     
  9. Stimo

    Stimo Active Member

    Yes the image directory is in the web root, which is why the slash is there. Still nothing though.
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
  11. Stimo

    Stimo Active Member

    Really cannot see anything wrong, is this code suppose to replace another code?
     
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
  13. Stimo

    Stimo Active Member

    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.
     
  14. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Where did you add that code in the template? Maybe it's within another condition that is false.
     
  15. Stimo

    Stimo Active Member

  16. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
  17. Stimo

    Stimo Active Member

    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?
     
  18. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Here is a picture of a field_id:

    http://xenforo.com/community/attachments/screen-shot-2011-10-28-at-3-56-57-pm-png.20678/

    If you have multiple styles enabled then the name of the style will show in the bottom left of the screen.

    Yes, at the top. It will display at the top of each post on the front end.
     
  19. Stimo

    Stimo Active Member

  20. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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}
    
     

Share This Page