XF 1.5 How to show value below user's post?

HSP

Member
I forgot how to display a custom field value below the content of each post. I did something in the template but I think I have dementia.
 
Style Properties -> Message Elements will display it below the avatar.

To display it elsewhere would require template edits.
 
Style Properties -> Message Elements will display it below the avatar.

To display it elsewhere would require template edits.

Thanks, no I didn't mean that. Some forums shows below the post(where the signature is) a custom field value.

I was hoping the name of the template. Is it "message"?
 
You can try using <xen:contentcheck> otherwise you may be able to use xen:if, depending on the param.

Thanks I need to try that too.

Currently I have am using this

Code:
<xen:if is="{$visitor.customFields.channelID}">
       <div class="g-ytsubscribe" data-channelid="{$visitor.customFields.channelID}" data-layout="full" data-count="default"></div>
       </xen:if>

But it's not showing to everyone :(
 
Depending on the template being worked with and what you are trying to do, you may need to use $user instead of $visitor; $visitor is always the record for the current logged in user, $user is the record being processed (e.g. message author, member list, list of online users, etc.).
 
  • Like
Reactions: HSP
Depending on the template being worked with and what you are trying to do, you may need to use $user instead of $visitor; $visitor is always the record for the current logged in user, $user is the record being processed (e.g. message author, member list, list of online users, etc.).
I want it to be for all visitors.
 
I think I have it correct?

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 1, 2, 3, 4, 5}">
            <xen:if is="{$message.customFields.channelID}">   
            <div class="g-ytsubscribe" data-channelid="{$message.customFields.channelID}" data-layout="full" data-count="default"></div>
            </xen:if>
        </xen:if>
 
When I apply
<xen:if hascontent="true"> code I get the following error message: "The following templates contained errors and were not saved: message: message - Line 66: Cannot have content-checking if tag without a contentcheck part."


Code:
<xen:if is="{xen:helper ismemberof, $visitor, 1, 2, 3, 4, 5}">
            <xen:if hascontent="true">
            <xen:if is="{$message.customFields.channelID}">   
            <xen:if hascontent="true"><div class="g-ytsubscribe" data-channelid="{$message.customFields.channelID}" data-layout="full" data-count="default"></div></xen:if>
            </xen:if>
            </xen:if>
        </xen:if>
 
As the error suggests, you need to use it with <xen:contentcheck>

Code:
<xen:if hascontent="true">
    <xen:contentcheck>
        ...
    </xen:contentcheck>
</xen:if>
 
  • Like
Reactions: HSP
Thank you so much for your time @Brogan I really appreciate it.

Here's the working end result:

Code:
<xen:if hascontent="true">
            <xen:contentcheck>
            <xen:if is="{xen:helper ismemberof, $visitor, 1, 2, 3, 4, 5}">
            <xen:if is="{$message.customFields.YOURCUSTOMFIELDIDHERE}">  
            <div class="g-ytsubscribe" data-channelid="{$message.customFields.YOURCUSTOMFIELDIDHERE}" data-layout="full" data-count="default"></div>
            </xen:if>
            </xen:if>
            </xen:contentcheck>
        </xen:if>
 
Last edited:
Top Bottom