Skip Navigation

[Resolved] Problems with using the Messaging System

This support ticket is created 3 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 17 replies, has 2 voices.

Last updated by alperenK 3 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#1883001
messaging-system-single-item-layout.png
messaging-system-single-item.png
Mailbox - inbox.png

Tell us what you are trying to do?
In the message - single item layout there is a bug - not related messages from persons are shown (all messages from everyone)
Is there any documentation that you are following?
there are no other same tickets about this bug
Is there a similar example that we can see?
see attached pictures
What is the link to your site?
hidden link (maintenance mode on)

#1884003

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I see you reported, we will split the ticket with your additional questions so lets fix the issue one by one.

We can address the issue of number of message count displayed on your nav bar.

Can you please share access details and problem URL where I can see the nav bar.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1885015

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've created a view that should display the message sent count, you can see its as given under:
=> hidden link

And added the view with the Outbox text on the following page:
=> hidden link

You can adjust the same way on your other pages.

Regarding Message Received, I've created another view that should display the received count:
=> hidden link

And added the view with the Inbox text on the following page:
=> hidden link

Can you please confirm it works as expected.

#1885215
messages-count.png

The number is +1 more then shown in the inbox & outbox (Inbox = 4, should be - Outbox = 3, should be 2)

This is very great to see how easy you create the views, but my question would be, where do you enter f. e. the brackets ( 3 ) around the number? Outbox looks fine on the frontend but Inbox is shown splitted. I'm trying to find out how I can fix this issues by my own.

Thanks a lot for your help!!

#1885639

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've fixed that bracket issue. Can you please check now and confirm that it works as expected.

#1885951
VIEW_PARAM(info).png
outbox count.png
inbox count.png

The bracket issue is fixed, thank you! But the message count number is wrong - it counts not the messages from different authors instead the number of replied or received messages.. see attached pictures

shortcode info="id" --> here I need to display the number of messages from different authors

#1885979

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

It will require further customizations. There is no such feature and its not easy to get outbox as we will require to navigate through all the replies the current user made and due to that it may affect the performance.

You will require to think another way, maybe you can add a custom field that holds the total count of message send and message receive and we should just display that custom user field value. What you think?

#1885989

Sure, I'm open for any options like adding a custom user field. There are already the views integrated in the Messaging System (Messages sent, Messages received) which I integrated already as Inbox and Outbox.

Is it difficult to count the "shown" messages here (picture inbox & outbox) instead of counting the number of replied messages in total?

#1885991

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Lets see if we can manage it using views rather using custom user field.

As requested in another ticket. I will require three user details.
- Admin user
- Sender user
- Receiver user

Can you please share those details.

In addition to that, is that Ok if I remove all messages and start from first for both sender/receiver user?

I have set the next reply to private which means only you and I have access to it.

#1886925

Hi Minesh, I needed to change the admin password because it didn't worked anymore. Edited the actual PW in the private message section above.

#1888747

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I just checked the Toolset Support user (loggedin), When I see messages:
=> hidden link

If you see the "toolset" user has two posts, that is why its displaying the 2 as Outbox.
=> hidden link

So, do you want that if the original message is created by loggedin user, it should be skipped and only replied messages should be considered?

#1889023

The goal is to count the "First Message ID"s without duplicates --> in the picture "inbox count" you see 3 messages from different authors (3 Different First Message IDs from different authors)

When I am receiver and get f.e. 5 messages from different authors/users in this case, the number 5 should be target for inbox view as "started conversations". If I am sender and write to 2 different "user", target for outbox should be "2" for outbox view.

#1889273

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

But, one user can have multiple messages created in that case, you still want to count per user.

For example, user 1 created 2 messages, user 2 created 3 different messages (a top level messages with unique First Message IDs) so in that case we have total 5 messages but you still want to display 2 as count because two users involved here irrespective of message count - correct?

#1889693

Hi Minesh, in that case (if only user 1 started a conversation with user 2, with replies to each other, we have in total 5 messages - user 1 = 2 messages; user 2 = 3 messages) the inbox and outbox number displayed in the navbar should be "1" for both user.

Inbox-view for user 1 & 2: Here is only "1" message displayed (last child of conversation or "chat" with user 1 & 2)

Outbox-view for user 1 & 2: Here is only "1" message displayed (last...)

If a new conversation or "chat" will startet (not with "reply" button) by f.e. from user 1 to user 2 again, the number in navbar now should be "2" for both and also in the views the new started "chat" from same user will be displayed.

#1891253

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The thing is that there is no easy way to count the message in such scenario, as if we want to use views to get count we may need to use nested views and it may not be good for performance aspect.

The only quick solution I can think of is writing a custom shortcode where we need to write a custom query to get count as per the conditions you mentioned and return the count and we will display that count.

This is requires the custom code and that is beyond the scope of the support policy, however, I'm sharing here the shortcode that will display the Outbox count.

add_shortcode('get_msg_count', 'func_show_msg_count');
function func_show_msg_count($atts) {

global $wpdb;
global $current_user;
$query = "SELECT count(a.ID) FROM wp_kar_posts a, wp_kar_postmeta b WHERE (a.ID=b.post_id) AND (b.meta_key= 'wpcf-first-message-id' and b.meta_value=a.ID)  and a.post_author=".$current_user->ID;
$res = $wpdb->query($query);

return $res;

}

And I've added the above shortcode to "Custom Code" section offered by Toolset:
=> hidden link

And also called the above shortcode as: [get_msg_count] to your page on left nav bar just besides the Outbox:
=> hidden link

The same way you will require to write the shortcode for the receiver (Inbox) and adjust your view's output (message send and message received) accordingly.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.