• 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?

Sheldon

Well-known member
#1
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?
 

SneakyDave

Well-known member
#2
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.
 

SneakyDave

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

Sheldon

Well-known member
#5
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.
 

Steve F

Well-known member
#7
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>
 

SneakyDave

Well-known member
#8
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
 

Sheldon

Well-known member
#9
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...
 

SneakyDave

Well-known member
#10
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
 

Steve F

Well-known member
#11
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}" />
 

Sheldon

Well-known member
#13
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.