XF 2.2 Insert Link in Signature per custom userfield

Rene B.

Member
Hi all,

I want to create a custom user field that will be visible in the user settings. There users can activate the checkbox. If they do that, a link should appear at the end of their signature. Creating the custom userfield is no problem, but how do I get the link in the signature? Is anyone able to help me?

thx in advance
René
 
Salut, you need to edit the message_macros template, find this part :
HTML:
<xf:macro name="signature" arg-user="!">
    <xf:if is="$xf.visitor.Option.content_show_signature AND $user.Profile.signature">
        <xf:if contentcheck="true">
            <aside class="message-signature">
            <xf:contentcheck>
                {{ bb_code($user.Profile.signature, 'user:signature', $user) }}
            </xf:contentcheck>
            </aside>
        </xf:if>
    </xf:if>
</xf:macro>

Below {{ bb_code($user.Profile.signature, 'user:signature', $user) }} add
HTML:
<xf:if is="$xf.visitor.Profile.custom_fields.yourcustomfieldID =='1'">
    your content...
</xf:if>
Change yourcustomfieldID by yours.

Not tested but it should work.
 
Thanks, that works, but not yet in the way I would like.
If user 1 activates the custom user field, the link is displayed in the signature. But in all signatures, not just for user 1. However, the link should only appear in the signature of user 1. Only when a user activates the custom user field should the link appear in his signature.
 
Top Bottom