Skip Navigation

[Resolved] Received Message View – Filter

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Waqar 1 year, 7 months ago.

Assisted by: Waqar.

Author
Posts
#2593077
Unbenannt.JPG

My view of sent messages works correctly. However, when viewing the received messages, I see all messages from all users. Which filter should be used to show only the messages that are addressed to the logged in user? Attached is my current filter which does not work.

Thank you for your great support!

#2593563

Hi,

To suggest the correct query filter setting, I'll need to see how this 'messages' custom post type and its fields are set up.

Can you please share the temporary admin login details, along with the link to the page with this view?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2595971

Thank you for sharing the access details.

Here are the changes that I'll recommend to make the view 'Messages received', work correctly:

1. Since we'll be comparing the ID of the user to whom the message is 'sent to', the comparison type in the query filter should be 'number' and not 'string'.
( screenshot: hidden link )

2. On the page 'Mein Account', this is the shortcode that is being used to call this view:


[wpv-view name="Messages received"]

But, we need to specify through the shortcode attribute 'info', the ID of the currently logged-in user, so that only messages sent to that user are shown by the view:


[wpv-view name="Messages received" info="[wpv-post-author format='meta' meta='ID']"]

After making these changes, please make sure that the 'Nachricht für' field in each 'Messages' post has the correct ID stored for the user to whom the message is 'sent to' and the view will show only the relevant messages.

I hope this helps and please let me know if you need further assistance.

#2596325
Screenshot 2023-04-18 171709.png

Thank you very much for your help.

I have taken over your changes. And tested the messaging system. Unfortunately, however, the received messages are not displayed in "My Account" although the recipient receives an email notification about the message. Unfortunately, when the recipient clicks on the link in the email, they cannot see the message either (only the title and error message "You cannot view this message." see attched).

However, I did not check your advice "please make sure that the 'Message for' field in each 'Messages' post has the correct ID stored for the user to whom the message is 'sent to' and the view will show only the relevant messages.". Because I don't know how to not check the correct ID. Sorry

#2597203

Thanks for writing back.

I've checked the Forms and custom fields related to the custom post type 'messages' and noticed two different types of fields for storing 'to' and 'from' user IDs.

In the custom field group named 'Message details', you have these two fields

1. Nachricht von ( field slug: nachricht-von )
2. Nachricht für ( field slug: nachricht-fuer )

But, in the two forms for the 'messages' ( i.e. 'New message' & 'Reply message' ), these two fields are not being used. These forms are using generic fields with slugs 'message-from' and 'message-to' and so the IDs of those users are not getting stored in the correct fields.

Please replace all references of the fields slugs in these forms to use the field slugs from the field group 'Message details' and then use these forms to create some new messages.