No announcement yet.

Custom Profile Fields Grapics

  • Filter
  • Time
  • Show
Clear All
new posts

  • [vB5] Custom Profile Fields Grapics

    This topic is often pointed to for directions about creating custom profile fields. VB versions prior to 5.x.x allowed images to be displayed, as examples, for country flags, sports teams, zodiac signs & others. Creating the fields, hook, template, enabling hooks, & displaying fields as text works.

    How to code to display a graphic for each field added? (Have seen the mod referred to, here & elsewhere, doesn't work.)

    Hooks enabled, template created, field created, images uploaded to server. Overlooking something. Where to insert/add image call? What I've got in the conversation_fields template, thanks for input:

    {vb:data userInfo, user, fetchProfileInfo, {vb:raw conversation.userid}}

    <vb:if condition="$userInfo['field18']"><li><label>{vb<colon>phrase field18_title}: </label> <span>{vb:raw userInfo.customFields.default.field18_title.val}</span></li></vb:if>
    (Emoticon displays here using a colon, instead of <colon> )
    Last edited by Rakehel; Thu 12 Nov '20, 1:08pm.

  • #2
    If your picture have the same name as the value you could use it to show pictures you uploaded to your server.

    HTML Code:
    {vb:raw userInfo.customFields.default.field18_title.val}
    This is one way to do it.


    • #3
      Thanks for replying delicjous. I'm not following, but I may have overlooked reporting one detail. Images are selected by members from drop-down menus in their profile settings. The profile field us set up as a "Single-Line Selection" menu per article directions.

      The flag images - country, state, miscellaneous - number maybe 200-300 images on the server. Sports team listing, including international team logos, about the same.

      The hope is to avoid prepackaged mods & default template edits.

      The tutorial here produces the lines below. The image was captured after selecting a flag in my profile. The field is then displayed a 2nd time as text as well, no image. If no image is selected, only one set of fields. (If "Team" & "Zodiac" are selected they are reproduced a 2nd time as well.) :

      Click image for larger version

Name:	Custom Profile Fields - member profile data selected.png
Views:	239
Size:	1.5 KB
ID:	4450115

      It seems like code looking something like the following should be inserted in the tutorial code in order to call an image:

      <img src="./forum/images/flags/{vb:raw post.field18}" align="middle" alt="{vb:raw post.field18}" border=""/>
      Here is unused example code from old vb 4.x.x directions that used to work:

      <vb:if condition="$post['fieldX']"> <dt>Country</dt> <img src="http://www.YOURFORUM{vb:raw post.fieldX}.GIF" alt="This is {vb:raw post.username}'s Country Flag" border="" /></vb:if></p>


      Related Topics