• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 Conversation List Item

Amaury

Well-known member
#1
I've been changing a lot of templates containing "datetime" and changing the comma separator to a vertical pipe separator between the username and date stamp or what have you as well as calling phrases in the templates (e.g., posted_by and posted). However, I am having trouble with the template for the conversation list.

This is how it currently is:
Convo.png

I want there to be a vertical pipe between the usernames and date stamp, so if I change this:

Code:
<xen:if is="{$recipient.user_id} != {$conversation.user_id}"><xen:username user="$recipient">{xen:if $recipient.user_id, $recipient.username, {xen:phrase unknown_member}}</xen:username>,</xen:if>
To this:

Code:
<xen:if is="{$recipient.user_id} != {$conversation.user_id}"><xen:username user="$recipient">{xen:if $recipient.user_id, $recipient.username, {xen:phrase unknown_member}}</xen:username> |</xen:if>
It works, but the problem is when there are three or more conversation participants, it displays like this:

Convo Display.png

There should be a comma after my name, not a vertical pipe.

Any help?
 

Arty

Well-known member
#2
Its a loop iterating all users, so you need to change it to use comma if there are more loop entries and pipe if its last loop entry:
Code:
          <xen:foreach loop="$conversation.recipientNames" value="$recipient" i="$i" count="$total">
             <xen:if is="{$recipient.user_id} != {$conversation.user_id}"><xen:username user="$recipient">{xen:if $recipient.user_id, $recipient.username, {xen:phrase unknown_member}}</xen:username><xen:if is="{$i} == {$total}">|<xen:else />,</xen:if></xen:if>
           </xen:foreach>
 

Amaury

Well-known member
#3
Its a loop iterating all users, so you need to change it to use comma if there are more loop entries and pipe if its last loop entry:
Code:
          <xen:foreach loop="$conversation.recipientNames" value="$recipient" i="$i" count="$total">
             <xen:if is="{$recipient.user_id} != {$conversation.user_id}"><xen:username user="$recipient">{xen:if $recipient.user_id, $recipient.username, {xen:phrase unknown_member}}</xen:username><xen:if is="{$i} == {$total}">|<xen:else />,</xen:if></xen:if>
           </xen:foreach>
So just change what I have to the above or do I add the above as a separate line of code?