I guess the macro has no access toHowever, I can only see B even in conversation page which showsdata-template="conversation_view"
in the header.
$template
. $xf.reply.template
.I guess the macro has no access to$template
.
Try replacing it with$xf.reply.template
.
well, basically, if your code is inside aThanks it helps! How can I know which variable to use?
<xf:macro>
tag, you will only have access to the variables, that are passed to that macro and to $xf
.<xf:if is="{{$forum.node_id == 53 && $user.Profile.custom_fields.DDCharName}}"><xf:username user="$user.Profile.custom_fields.DDCharName" rich="true" defaultname="{$fallbackName}" itemprop="name" /><xf:else /><xf:username user="$user" rich="true" defaultname="{$fallbackName}" itemprop="name" /></xf:if>
<xf:username .. />
. This template function takes a User
object ($user
in your code) and this has the user name included.<xf:if is="$forum.node_id == 53 && $user.Profile.custom_fields.DDCharName">
[COLOR=rgb(224, 224, 224)] $user.Profile.custom_fields.DDCharName
<xf:else />
<!-- // your default code -->
</xf:if>
Yeah, I assumed it would be something to do with that. I tried just the custom field, that doesn't work, either.I don't think this will work with<xf:username .. />
. This template function takes aUser
object ($user
in your code) and this has the user name included.
So, if you just want to display a user name as plain text, you could do something like:
HTML:<xf:if is="$forum.node_id == 53 && $user.Profile.custom_fields.DDCharName"> [COLOR=rgb(224, 224, 224)] $user.Profile.custom_fields.DDCharName <xf:else /> <!-- // your default code --> </xf:if>
If you want more fancy stuff (like displaying an alternative user overlay), I think you will need to code an add-on.[/COLOR]
Yeah, I assumed it would be something to do with that. I tried just the custom field, that doesn't work, either.
<xf:if is="$forum.node_id == 53 && $user.Profile.custom_fields.DDCharName">
{{$user.Profile.custom_fields.DDCharName}}
<xf:else />
<!-- // your default code -->
</xf:if>
what template (part) are you editing? Are you sure you have access toThat's a no-go, as well.
$user
and $forum
there? Maybe it's inside a template macro?message_macrowhat template (part) are you editing? Are you sure you have access to$user
and$forum
there? Maybe it's inside a template macro?
o.k. so it'smessage_macro
message_macros
, so this part should work:{{$user.Profile.custom_fields.DDCharName}}
$forum
. Try replacing that part with $xf.reply.contentKey == 'node-53'
.<xf:if is="$xf.reply.contentKey == 'node-53' && $user.Profile.custom_fields.DDCharName">
{{$user.Profile.custom_fields.DDCharName}}
<xf:else />
<!-- // your default code -->
</xf:if>
That's still not doing it, sadly.o.k. so it'smessage_macros
, so this part should work:
{{$user.Profile.custom_fields.DDCharName}}
but you won't have access to$forum
. Try replacing that part with$xf.reply.contentKey == 'node-53'
.
So, try this (untested):
HTML:<xf:if is="$xf.reply.contentKey == 'node-53' && $user.Profile.custom_fields.DDCharName"> {{$user.Profile.custom_fields.DDCharName}} <xf:else /> <!-- // your default code --> </xf:if>
<xf:if is="in_array({$thread.forum_id}, [53, 55, 56, 57]) && !empty($user.Profile.custom_fields.DDCharName)">
{{$user.Profile.custom_fields.DDCharName}}
<xf:else />
<xf:username user="$user" rich="true" defaultname="{$fallbackName}" itemprop="name" />
</xf:if>
<xf:if is="$xf.reply.containerKey == 'node-53' && $user.Profile.custom_fields.DDCharName">
{{$user.Profile.custom_fields.DDCharName}}
<xf:else />
<h4 class="message-name"><xf:username user="$user" rich="true" defaultname="{$fallbackName}" itemprop="{{ $includeMicrodata ? 'name' : '' }}" /></h4>
</xf:if>
Then you have to write:Tried this approach, as well (we added sub-forums, lol):
in_array($xf.reply.containerKey, ['node-53','node-55','node-56','node-57'])
We use essential cookies to make this site work, and optional cookies to enhance your experience.