XF 1.5 Problem with display of custom user field

octabrain

Member
Hi,
I am trying to display a custom user field on a users profile field. My custom user field contains an url, and I want to display this on each users profile as a link and it should simply display the username as title for the link.

So I set the Value Disply HTML to:
<a href="{$value}">{$user.username}</a>

Then it shows the link on the profile but it still has {$user.username} there, instead of the username.
How do I get the username in there?
 
Ok, just checking in here again. Still looking for a solution for this.
That's now a bit dissapointing to not get an answer to a seemingly simple question in 18 days. After all we pay for some kind of support here or not?
 
I have essentially the same question and may get the same response. I am trying to import my user selected flags add-on from vBulletin and during the transfer the custom fields did come through, but I cannot figure out how to get the actual image to display. To check it out, I put in a literal value for the url, but I cannot figure out what is needed to make it use the user selected value either as {$value} or as {$valueUrl}.

I am guessing that I need to make an edit to the template, but this material is shown in a definition list element and I have not been able to figure out the correct syntax.

Any advice?
customuser.webp
 
I managed to half answer my own question by trying a bit harder.

This syntax works if the argument does not have a space in the file name:
Code:
<img src="/data/flags/{valueUrl}.gif" />
However my region flag names all have a 2 character country prefix followed by a space and the region name. Is there some way to escape spaces in {valueUrl}? That is other than replacing all the spaces with a legal character?

later...

Since {value} works in my example of the country as well as {valueUrl} I am wondering what the function of {valueUrl} might be. I initially thought it would provide a valid urlencoding and replace the space with %20. It does not seem to do that and the base code also seems to reject a + instead of the %20. I guess I need to find another tutorial.
 
Last edited:
However my region flag names all have a 2 character country prefix followed by a space and the region name. Is there some way to escape spaces in {valueUrl}? That is other than replacing all the spaces with a legal character?
We use Drop down selection to allow users to select their favorite flag and match the {$choice} with the file name
upload_2017-6-13_23-2-31.webp
upload_2017-6-13_23-28-28.webp
upload_2017-6-13_23-38-10.webp
 
Last edited:
Hi,
I am trying to display a custom user field on a users profile field. My custom user field contains an url, and I want to display this on each users profile as a link and it should simply display the username as title for the link.

So I set the Value Disply HTML to:
<a href="{$value}">{$user.username}</a>

Then it shows the link on the profile but it still has {$user.username} there, instead of the username.
How do I get the username in there?
I think this only works with a template edit
member_view template
Rich (BB code):
<xen:if is="{$user.customFields.fieldID}">
     <dl><dt>{xen:helper userFieldTitle, fieldID}:</dt> <dd><a href="{$user.customFields.fieldID}" target="_blank">{$user.username}</a></dd></dl>
</xen:if>
message_user_info template
Rich (BB code):
<xen:if is="{$user.customFields.fieldID}">
     <dl class="pairsJustified">
          <dt>{xen:helper userFieldTitle, fieldID}:</dt>
          <dd><a href="{$user.customFields.fieldID}" target="_blank">{$user.username}</a></dd>
     </dl>
</xen:if>
 
We use Drop down selection to allow users to select their favorite flag and match the {$choice} with the file name
Yes, ours works exactly the same as long as the filename that is referenced for the flag has no spaces in it. We also have state/region/affinity flags that members may choose and those have been stored with a space character in the file name. I wish that the add on escaped space characters to create a valid URL.

As I mentioned, we could modify the file names so that the prefix had a + or possibly underscore character instead of the space character.
 
Back
Top Bottom