Module

Archived
Forum
(read-only)

Messaging

ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6

Back to this add-on's main page
View Other Add-ons From Yuri Salimovskiy

     

A few issues…

Support Request

TVPDan
TVPDan

Hi, so I’m facing a few different issues that I’m hoping you can help me with, and please note that we are using Zoo Visitor:

1. In testing the system, we’re sending & replying PM’s between several test members we have set up. Once our testing & development is complete, how can we remove all PM’s from the system so that we can hand the project to the client with a clean slate? Furthermore, is there anywhere in the CP that we can see all the messages that have been sent/received?

2. When using the code to view messages in conversation mode, the logged in member doesn’t see their messages in the conversation but only sees the other members replies. So it doesn’t make it possible for the logged in member to see what they wrote. The code we are using is:

{exp:messaging:pm_thread message_id="{segment_3}" backspace="6"}
<h4>{if "{count}"=="1"}{subject}{/if}</h4>
{sender_screen_name}<br />
{message}<br />
{message_date format="%Y-%m-%d"}<br />
<
hr />
{/exp:messaging:pm_thread} 

Then if I log in as the other member, again, I only see the replies and none of my responses/messages in the conversation.

3. In a members Inbox, they see a message they have received. If the member replies to that message, and then receives another reply back, another Inbox item with “RE:” + subject is added to the Inbox. Now there are two messages in the inbox with the exact same content but one has RE: in the subject line.

Code being used to display Inbox:

{exp:messaging:private_messages}
sender_screen_name}
{subject}
{message_date format
="%Y-%m-%d"}
{if unread}UNREAD{if
:else}READ{/if}
<a href="/account/messages/{message_id}">VIEW</a>
{/exp:messaging:private_messages} 

I’ll stop there for now to see if fixing the above could fix other issues.

Hope I was clear…hard to explain this sometimes like this.

Thanks,
Dan

Yuri Salimovskiy
# 1
Developer
Yuri Salimovskiy

Hi Dan,

1. You can truncate exp_message_copies and exp_message_data folders. There’s no way to see other members’ messages.

2. The messages if grouped by subject. So if it looks like you see only half of the thread, then the other party’s subject is not the same. Note that the only allowed change to subject is “Re: ” (uppercase R, lowercase e, followed by semicolon and space)

3. When message is sent, a copy is sent in “sent” folder. Your code displays all messages by member, that’s why you see it. Add folder=“inbox” parameter to view inbox only

TVPDan
# 2
TVPDan

Hi Yuri,

Thanks for the quick response.

So the issue is that the subject is exactly the same and just has the RE: as you mentioned in front of it, but still we only see half of the conversation thread, meaning that the member only sees the other members responses and none of their one in the thread.

I’m using exactly the code you have provided and so the subject is not being altered in any way.

As for the other point, I added folder=“inbox” but it made no difference and I still see all the messages. Then I tried changing it to folder=“sent” just to see what happens, and none of the reply messages come up either.

Thoughts?

TVPDan
# 3
TVPDan

FYI, I’m using EE 2.10.1, just in case that helps in any way.

Yuri Salimovskiy
# 4
Developer
Yuri Salimovskiy

Are you using latest 0.7.3 version of the add-on? If not, please upgrade first.

If you run latest version, drop me a line to support@intoetive.com with EE access details and I’ll have a look (though that might not happen before end of the week)

TVPDan
# 5
TVPDan

Yes, I just purchased it a few days ago, so it’s definitely the latest version.
I’ll setup an account for you and email with the details.

Thanks for your quick replies!

TVPDan
# 6
TVPDan

So I fixed one part of the issue which the documentation doesn’t cover for anyone else:

When doing a PM compose for a reply, you have to explicitly define save_sent=“yes” otherwise when looking in the DB, it is set to N which means in a PM thread, it doesn’t come up. When I set save_sent=“yes”, the back and forth between two members started showing up when using pm_thread

TVPDan
# 7
TVPDan

So in trying to fix the other issue with the Inbox showing all messages (duplicates of the same conversation when replied to), I tried something which partially addressed it but caused another issue.

Yuri, what do you think?

For the Inbox to not show duplicates of replies and only show one copy of the subject that can be clicked on to see the entire thread, I had to go into mod.messaging.php and in line 1704 I added:

$this->EE->db->where('exp_message_copies.message_status !=''replied'); 

But now, unless the member I have replied to also replies back, their messages doesn’t show up in the Inbox anymore.

I ran your query, based off of mod.messaging.php in the DB Query in the CP:

SELECT exp_message_copies.message_statusexp_message_copies.message_idexp_message_copies.message_receivedexp_message_copies.message_readexp_message_copies.copy_id,  exp_message_copies.recipient_idexp_message_data.sender_id,  exp_message_data.message_date,  exp_message_data.message_subjectexp_message_data.message_bodyexp_message_data.message_recipientsexp_message_data.message_ccexp_message_data.message_attachmentsexp_members.screen_nameexp_members.usernameexp_members.emailexp_members.avatar_filenameexp_members.photo_filename FROM exp_message_copies LEFT JOIN exp_message_data ON exp_message_copies.message_id exp_message_data.message_id LEFT JOIN exp_members ON exp_members.member_id exp_message_copies.sender_id WHERE exp_message_copies.recipient_id AND exp_message_copies.message_folder AND exp_message_copies.message_deleted 'n' AND exp_message_data.message_status 'sent' 

And this produced the initial issue I was talking about, which shows multiple results for the same private message thread in the Inbox even if they are the same conversation but just replies.

Thoughts?

Yuri Salimovskiy
# 8
Developer
Yuri Salimovskiy

My bad - save_sent=“yes” is indeed required for threads to work.

Now that we’ve figured out perhaps you need to only test with new messages sent with that parameter enabled? Removing “replied” messages from display is not too good idea.

TVPDan
# 9
TVPDan

So I tried with that new parameter of save_sent = “yes” and removed by line in your code which removed status “replied”...still, the Inbox is giving me multiple results for the same conversation but each with a different ID…I guess it’s seeing each reply as an entry in the Inbox and showing that, but clicking on any of them results in the same conversation thread showing.

Yuri Salimovskiy
# 10
Developer
Yuri Salimovskiy

But each reply IS different entry.

If you want to list message threads (and not each individual message) then you need to use exp:messaging:conversations tag instead of private_messages: http://www.intoeetive.com/docs/messaging.html#conversation

TVPDan
# 11
TVPDan

So that makes a lot more sense now!

The only thing now is that using the conversations tag, in the members Inbox, the FROM value for a single conversation is the last sender’s name, so that member replied, they see the message with a FROM of themself. If I use the conversation variable pair, then I get each users screen name for each time that either of the members replied.

I guess basically there is a need (unless there is already and I don’t know about it) for a single variable inside the conversation tag to show me the first person who started the conversation so that their name can be put in the FROM area of the Inbox overview.

Yuri Salimovskiy
# 12
Developer
Yuri Salimovskiy

What you need is conditiona check in template.
Something like

{if '{last_sender_username}'!='{logged_in_username}'}
{last_sender_screen_name} 
({last_sender_username})
{if:else}
{last_recipient_screen_name} 
({last_recipient_username}
{/if} 
TVPDan
# 13
TVPDan

Excellent!

Thanks for your quick replies! Things are working as expected now…two thumbs up :)

TVPDan
# 14
TVPDan

Hi Yuri, another question:

When I use:

<img class="avatar" src="{sender_photo_url}" alt="avatar"

The image comes up for the member.

But, some members have not yet uploaded an image, so I’m trying:

{if sender_photo_url == ""}
<img class="avatar" src="/images/base_images/no-profile-image.png" alt="avatar">
{if:else}
<img class="avatar" src="{sender_photo_url}" alt="avatar">
{/if} 

But this always produces the no profile image even if the member has an image which worked before in the first code above.

Thoughts?

Yuri Salimovskiy
# 15
Developer
Yuri Salimovskiy

Try

{if "{sender_photo_url}" == ""