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

XF 1.3 Help with Custom UserField Title Display?

Discussion in 'Styling and Customization Questions' started by Sheldon, Jul 9, 2014.

  1. Sheldon

    Sheldon Well-Known Member

    Alright... trying to get the actual title to display correctly...

    Code:
    <xen:if is="{$user.customFields.superpower1}">
        <div class="superPower11">
        <a href="{xen:link account/preferences}" class="OverlayTrigger">
             <img class= "superpower1 Tooltip" title="{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}" src="/images/superpowers/{$user.customFields.superpower1}.png" />
        </a>
        </div>
    </xen:if>
    
    <xen:if is="{$user.customFields.superpower2}">
        <div class="superPower22">
             <img class= "superpower2 Tooltip" title="{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}" src="/images/superpowers/{$user.customFields.superpower2}.png" />
        </div>
    </xen:if>
    
                         
    <xen:if is="{$user.customFields.superpower3}">
        <div class="superPower33">
             <img class= "superpower3 Tooltip" title="{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}" src="/images/superpowers/{$user.customFields.superpower3}.png" />
        </div>
    </xen:if>
    That is my current code. Hovering over the third image gives me that tooltip...

    Screenshot_9.png

    However... so do the other two... hahah.
    hover.gif

    So, obviously I am missing something, but I honestly have no clue what it is....

    Any help?
     
  2. SneakyDave

    SneakyDave Well-Known Member

    Well, your conditional probably needs some help
    Code:
    <xen:if is="{$user.customFields.superpower3}">
    
    Always results in a true statement, same for the other ones. Are you trying to see if the customField is populated?

    You may have to check to see if the super power is "not null", but not sure how to do that in xenforo. I'll do some searching.
     
  3. Sheldon

    Sheldon Well-Known Member

    Yeah, I am lost in these things...
     
  4. SneakyDave

    SneakyDave Well-Known Member

    maybe this?
    Code:
    <xen:if is="isset({$user.customFields.superpower3})">
    
    That should check that the value for superpower3 is set and not null.
     
  5. Sheldon

    Sheldon Well-Known Member

    Ok.. I'll try that.

    Here is why I used what I did...

    How can I show content to members who have completed a custom user field?
    <xen:if is="{$visitor.customFields.field_id}">
    This content will show to members who have completed the custom user field
    </xen:if>
    Note that field_id must be replaced with the actual custom user field identifier.
     
  6. SneakyDave

    SneakyDave Well-Known Member

    I've used the same thing, but have noticed that it shows whether the profile field is entered or not.
     
  7. Steve F

    Steve F Well-Known Member

    Here is a bit of code I have been doing for a add on, might help you.


    Code:
    <!-- Origin Profile -->
        <xen:if is="{$user.customFields.originUserProfile}">
                <a href="{xen:link 'members/', $user}"><span class="gamerIcon originUserProfile Tooltip" data-offsetX="-6" title="{xen:phrase gp_origin}: {$user.customFields.originUserProfile}"></span></a>
        </xen:if>
    
     
  8. SneakyDave

    SneakyDave Well-Known Member

    Scratch that, you may have to change the title tag, just a guess.

    Code:
    <img class= "superpower3 Tooltip" title="{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}" src="/images/superpowers/{$user.customFields.superpower3}.png" />
    Change the {$fieldID}} to the actual profile field, such as:

    Code:
    <img class= "superpower3 Tooltip" title="{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.superpower3}" src="/images/superpowers/{$user.customFields.superpower3}.png" />
    Because I think the $fieldID will be set to the last thing it fetched (superpower3)

    Not entirely sure that will work, not familiar with xen:helper
     
  9. Sheldon

    Sheldon Well-Known Member

    This is what I can get.
    hover2.gif

    Using this code:
    Code:
    <xen:if is="{$user.customFields.superpower3}">
        <div class="superPower11">
        <a href="{xen:link account/preferences}" class="OverlayTrigger">
             <img class="superpower1 Tooltip" title="{$user.customFields.superpower1}" src="/images/superpowers/{$user.customFields.superpower1}.png" />
        </a>
        </div>
    </xen:if>
    
    <xen:if is="{$user.customFields.superpower2}">
        <div class="superPower22">
             <img class="superpower2 Tooltip" title="{$user.customFields.superpower2}" src="/images/superpowers/{$user.customFields.superpower2}.png" />
        </div>
    </xen:if>
    
                        
    <xen:if is="{$user.customFields.superpower3}">
        <div class="superPower33">
             <img class="superpower3 Tooltip" title="{$user.customFields.superpower3}" src="/images/superpowers/{$user.customFields.superpower3}.png" />
        </div>
    </xen:if>
    Now, what I want are these titles:
    Screenshot_10.png

    To be shown as the "Tooltip" display, instead of the userfield choice.

    I've tried all the above. I'm missing something...
     
  10. SneakyDave

    SneakyDave Well-Known Member

    Can't you just change the title to the literal you want to use? such as:
    Code:
    <xen:if is="{$user.customFields.superpower3}">
        <div class="superPower33">
            <img class="superpower3 Tooltip" title="Insanely Rich" src="/images/superpowers/{$user.customFields.superpower3}.png" />
        </div>
    </xen:if>
    
    Oh I see, your superpower3 won't be "Insanely Rich", it'll be what they choose for their third superpower... ahhh
     
  11. Steve F

    Steve F Well-Known Member

    Check out the "Value Display HTML" in each custom user field.

    Example
    Code:
    <img src="/styles/site-images/{$choice}.png" class="genLevel Tooltip" title="Regeneration {$value}" alt="{$value}" />
     
    SneakyDave likes this.
  12. Sheldon

    Sheldon Well-Known Member

    Appreciate all the input you guys gave from here, as well as over at XenAdmins.

    Finally got it working.

    Thanks a ton!
     
    SneakyDave and Bob like this.
  13. Sheldon

    Sheldon Well-Known Member

    Oh, and the answer was provided by @Bob B .....

    Code:
    <img class= "superpower1 Tooltip" title="{xen:helper userFieldValue, 'superpower1', $user, {$user.customFields.superpower1}}" src="/images/superpowers/{$user.customFields.superpower1}.png" />
    Which resulted in what I needed:
    hover3.gif

    Cannot thank everyone enough.. nice community work.
     
    maxicep, SneakyDave and Bob like this.

Share This Page