XF 2.0 Add thread title to conversation

BassMan

Well-known member
I'd like to add a thread title to the conversation. This is what I have in my message_macros template:
Code:
<a href="{{ link('conversations/add', '', {'to': $user.username}) }}">{{ phrase('start_conversation')}}"></a>


If I try to add it like this it's not working:

Code:
<a href="{{ link('conversations/add', '', {'to': $user.username}, {'title': $thread.title}) }}">{{ phrase('start_conversation')}}"></a>

What am I doing wrong?

Thank you for any help or guidance.
 
Code:
<a href="{{ link('conversations/add', '', {'to': $user.username, 'title': $thread.title}) }}">{{ phrase('start_conversation')}}"></a>
 
Oh message_macros template? Where in there are you adding this? user_info?

You can see from the macro that the thread argument isn't available:
HTML:
<xf:macro name="user_info"
   arg-user="!"
   arg-fallbackName=""
   arg-dateHtml=""
   arg-linkHtml="">
You'd likely have to use:
Code:
<a href="{{ link('conversations/add', '', {'to': $user.username, 'title': $__globals.thread.title}) }}">{{ phrase('start_conversation')}}"></a>
Though you have to bear in mind that the user_info macro can be used in places where there is no thread record, e.g. in conversations or media gallery.

So you'd have to wrap it in:
Code:
<xf:if is="$__globals.thread">
 
I'm adding it to user details, yes.

Thank you very much for the explanation, Chris. I understand it better now and it works like it should.
 
Top Bottom