At the moment, if a user deletes a message they do not have permission to view the message again even if it is still on the database (i.e. if the same message has not been deleted by the other participant.). Also, when both users delete the same message it is removed completely from the database.
I have a requirement for the message participants to still be able to view the message and reply after they have deleted it from their messagebox. They would access the message by the permalink which would be stored on another post.
In addition I would like it so that even if both users delete the message, the message remains in the database and can still be viewed by both as above.
So as i understand delete do not do anything in your use case. You can remove delete option so that nobody can delete a message.
Please add following code in your theme’s (child theme’s if you are using) functions.php
2. A booking is completed. The booking confirmation contains the link to the parent message which now has fep meta ‘booking_confirmed’.
3. User a and user b can delete the message thread from the message box.
4. After message deletion, for either user, the message can be accessed from the booking confirmation. They have permission to view the message and can send further messages in the same thread.
Essentially, when a message is deleted by either user with meta ‘booking_confirmed’ it only means that they cannot see the message in the message box. Everything else is the same. It is more like “hide” message.