Home › Toolset Professional Support › [Resolved] sending message to post author
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 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Tagged: Toolset Forms
This topic contains 4 replies, has 2 voices.
Last updated by ericW-5 5 years, 1 month ago.
Assisted by: Shane.
I am trying to: send a message to the post author of a custom post type called 'missions' using toolset messaging system. The post is a job offer, the new message should be used to contact the post author. Only admin and role "agence premium" can post this message.
I installed the toolset messaging system as per https://toolset.com/learn/how-to-create-a-messaging-system-with-toolset/
Link to a page where the issue can be seen:
hidden link
Issue : The message is sent to userID 0 instead of the post author (in this case "testpp" / userID 249). How can I change that ?
Thanks in advance.
Hi Eric,
Thank you for getting in touch.
Try replacing
[types field='message-to' output='raw'][/types]
With
[wpv-post-author format='meta' meta='ID']
This should get the author information of the current page that the form is on.
Please try this and let me know if it helps.
Thanks,
Shane
Hi
thanks for your message. In fact I needed to add [wpv-post-author format='meta' meta='ID'] in the "new message form".
So now it works fine, user ID 249 receives the new message.
But I have another issue, now when user ID 249 replies to the message, the reply is sent to himself. I would need the reply message to be sent to the original sender instead.
What should I insert in the default "message to" in the reply form so that the original sender receives the reply message ?
I currently have this code in the reply message form :
[wpv-conditional if="( $(wpcf-message-from) ne '[wpv-current-user info="id"]' )"]
[cred_generic_field field='wpcf-message-to' type='hidden' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist":1,
"generic_type":"user_id",
"default":""
}
[/cred_generic_field]
[/wpv-conditional]
[wpv-conditional if="( $(wpcf-message-from) eq '[wpv-current-user info="id"]' )"]
[cred_generic_field field='wpcf-message-to' type='hidden' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist":1,
"generic_type":"user_id",
"default":"[types field='message-to' output='raw'][/types]"
}
[/cred_generic_field]
[/wpv-conditional]
Many thanks in advance for your help
Eric
Hi Eric,
I checked on this for you and there doesn't seem to be an issue.
The only problem would come when testing this if you're using the same user for e.g if the user with ID 249 is the author of the post that you are sending the message for and you are that logged in user with 249, then the message will be sent to you.
But I did a test on my end and the ID's end up being different. See Screenshot
So it should work fine.
Thanks,
Shane
My issue is resolved now. Thank you!