Skip Navigation

[Résolu] Message Module – To Recipient ID always zero

This support ticket is created Il y a 5 années et 6 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Marqué : 

Ce sujet contient 12 réponses, a 3 voix.

Dernière mise à jour par Christian Cox Il y a 5 années et 6 mois.

Assisté par: Christian Cox.


Tell us what you are trying to do?

Test message module prior to implementation

Is there any documentation that you are following?

Is there a similar example that we can see?

Yes if needed

What is the link to your site?

Ihave followed the instructions to implement the new message module and all looks to be workinng except the "To" usre ID is not being populated - it's zero.

I have made sure the author is correct on the contractor page and can display the user ID fine.

Ithink I have got something wrong somewhere - maybe you could suggest what I might be missing and I will have another look.



Not being a programmer, my code knowledge is limited but I don't see the functions.php code that stores "wpcf-message-to".

Is there some cred hook code missing in your instructions?



Hi, the wpcf-message-to slug refers to a Types custom field. Since the generic field is configured to use the same slug, the value is stored automatically without the need for any custom code. If the "to" address is stored as 0 in wp-admin, it could be because of where the New Message Form is displayed. The Form should be placed in the Author archive in order to work as written. It's already placed there when you import the Module. Go to Toolset > WordPress Archives > Author archive.

Then you can visit the New Message form by going to (replace username with the desired recipient's username). Then the custom shortcode get_author_id_in_archive will supply the correct User ID in your recipient generic field. If you place the New Message Form somewhere else, then you must edit the New Message Form, remove the get_author_id_in_archive shortcode, and pass in the User ID of the intended recipient some other way. Otherwise, the intended recipient's ID will not be correct.


Ah! Thanks Christian.

I was using the module in a club membership system so that club members could communicate with each other. To do that I needed some additional fields (set by a member) to say whether or not they were a part of the message facility. That is, they can opt out if they want.

I therefore created a post type and set the author = member, added the additional fields and then added the message send form. A member can display the post type of another club member and if they accept messages, the form would appear.

I will have to have another look at this and see how I can adapt what I have done.

At least I now know why it did not work for me and will be able to find a suitable solution.

Thanks again.


Sure, no problem. Let me know if you get stuck.


Hi Christian

I thought I could implement a simple change to the CRED form by changing

[cred_generic_field field='wpcf-message-to' type='hidden' class='' urlparam='']

TO ----------------------

[cred_generic_field field='wpcf-message-to' type='hidden' class='' urlparam='']
"default":"[wpv-post-author format='meta' meta='ID']"


expecting [wpv-post-author format='meta' meta='ID'] to be the user id of the post on which the CRED form is placed. Unfortunately it delivers the logged in user id.

Is there a parameter that can be added to [wpv-post-author format='meta' meta='ID'] so that the parent post can be used to supply the user id?

I am trying to avoid changing too much code.

Kind regards

PS I appreciate that this may be a legitimate support question but it might be useful to other Toolset Users.



Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Tony,

Christian is on Holiday today and will be back tomorrow to answer any concerns you may have.



You can use the "id" attribute of the wpv-post-author field to specify which post you want to query. If you want to access the author of the current post, you can use the $current_page operator like this:

[wpv-post-author format='meta' meta='ID' id='$current_page']

Thank you Christian - that does the job fine the from/to codes are now correct and I am able to adapt the message system to a membership site with just that one line change.

Hi [/types]“],

You have a message from [/types]“] [/types]“].

The code in the email message is:

<p>Hi [wpv-user field="user_firstname" id="[types field='message-to' output='raw'][/types]"],</p>
<p>You have a message from [wpv-user field="user_firstname" id="[types field='message-from' output='raw'][/types]"] [wpv-user field="user_lastname" id="[types field='message-from' output='raw'][/types]"].</p>
<p>Message: [wpv-post-excerpt length="80" more="..."]</p>
<p>This is an automated email, please do not reply to it.</p>
<p>You can reply directly here.</p>

I don't recall changing this yet so I wondered if there may be a problem with the syntax.

I recall that sometimes " and ' characters can cause problems.

Many thanks

Les nouveaux fils créés par Christian Cox et associés à celui-ci sont repris ci-dessous :


Okay great, I have split your question about the email notifications into a separate ticket, since it seems to be a bit different from the question about recipients and we have a one topic per ticket policy. I'll follow up there shortly:


My issue is resolved now. Thank you!


For information only.

Whenever I have something that I need to resolve, I (like others) always look for the solution within the help pages and previous support messages. Some things are very difficult to find for unskilled users.

For example, this solution (for me) was

[wpv-post-author format='meta' meta='ID' id='$current_page']

I knew about [wpv-post-author] but was/am not familar with the parameters that can be added. Adding a selection of useful adaptations of a short code (for dummies) would be simple to do and would save some support questions.

Dummies like copy and pasting code and makin changes to the bits they understand!

Experts can look at code and know what it all means so please take a look at the short codes and provide some useful examples without over describing things.

Thanks for the great support.



Thanks for the suggestion, I can see how this would be helpful. The best way to get new features added to the site or the software is to create a new ticket here in the forum using the "Suggest an improvement" option. This will put your request in front of our developers and documentation team, and they can decide how to best implement this new feature.

Ce ticket est maintenant fermé. Si vous êtes un client de Toolset et que vous avez besoin d'aide, veuillez ouvrir un nouveau ticket d'assistance