XF 1.4 Trailing Comma on Conversation List

Amaury

Well-known member
Our awesome coder @mike406 has finished revamping the following pages:
  • Discussion list
  • New Posts
  • Unread Watched Threads
  • All Watched Threads
  • Conversation list

However, we've hit a small problem on the conversation list:

upload_2014-11-6_21-48-9.webp

The problem isn't shown here, but if we remove the date / time stamp, we get a trailing comma (e.g., Amaury, Mike, Nights, Sean, instead of Amaury, Mike, Nights, Sean).

Here's part of our conversation on Skype, where Mike explained it:

[9:39:22 PM] Amaury: And there appears to be commas missing between usernames. See Host Login Info on the conversation list. They were there before removing the date, but we can look into that tomorrow. I'll see if I can do anything myself, though.
[9:41:08 PM] Mike: That was my bad, I tried taking the date out from that spot
[9:41:31 PM] Mike: I put that back
[9:41:45 PM] Amaury: The date can't be removed, then?
[9:42:03 PM] Mike: It can, but then there's that extra comma floating at the end of the names list :/
[9:42:18 PM] Mike: The code prints a comma after each name generation

Is there any way to work around this and remove the trailing comma?
 
If you want to remove the date and last comma of the user names then apply the following template modification to conversation_list_item :
Find:
Code:
<xen:foreach loop="$conversation.recipientNames" value="$recipient">
    <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>
</xen:foreach>

<a href="{xen:link conversations, $conversation}" class="faint"><xen:datetime time="$conversation.start_date" /></a>
Replace:
Code:
<xen:foreach loop="$conversation.recipientNames" value="$recipient" i="$i">
    <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 '{$i} < {$conversation.recipient_count} - 1', ','}</xen:if>
</xen:foreach>
 
If you want to remove the date and last comma of the user names then apply the following template modification to conversation_list_item :
Find:
Code:
<xen:foreach loop="$conversation.recipientNames" value="$recipient">
    <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>
</xen:foreach>

<a href="{xen:link conversations, $conversation}" class="faint"><xen:datetime time="$conversation.start_date" /></a>
Replace:
Code:
<xen:foreach loop="$conversation.recipientNames" value="$recipient" i="$i">
    <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 '{$i} < {$conversation.recipient_count} - 1', ','}</xen:if>
</xen:foreach>

Just to make sure we're on the same page, do you mean template modification literally or template modification as in a template edit? I'm just asking because I was told by @Chris D a while ago that template modifications are really more for developers and add-on developers.
 
Top Bottom