I am trying to: Get a proper email notification with information about the post a inquiry is made from
Link to a page where the issue can be seen: hidden link click on button "Posez une question"
On every add a visitor can click a button opening a inquiry form (popup CRED) to be filled with his coordinates. The acknowledgement message appearing after submission is correct with information about the post from where the inquiry has been sent from (using [wpv-post-link id="$auction-listing"]. ( see: hidden link)
However, in the notification email sent to the webmaster, only %%USER_LOGIN_NAME%% and %%POST_TITLE%% are showing; %%POST_PARENT_TITLE%% and %%POST_PARENT_LINK%% remain blank.
What am I missing there?
Also, any idea on how to get the acknowledgement into a popup instead of at the place where the button was?
Thanks
I just set up a test to check that the %% placeholders in CRED notifications work, and they all do on current versions.
I don't see any debug info for your site (https://toolset.com/faq/provide-debug-information-faster-support/), so can you first confirm that you are up-to-date with CRED 1.9.3 (which included fixes for several notification issues) as well as Types (2.2.20) and Views (2.5.1).
Also, the form in question is to create a child post type and includes a field (which is set) for the parent post, is that correct?
Thanks for your fast response. I do confirm that all Toolset plugins are of the latest version (updated today).
The form in question is meant for visitor of a particular custom post ( an ad) to ask a question related to this ad. This form is called by a shortcode placed within the layout attached to said CP and should therefore provide information back to the webmaster (via email notification) about the particular post it was triggered from. Perhaps the problem lies in the parent-child relationship, as the inquiry form is of a different CP type than the post it is triggered from?
It sounds like you are using it the right way, but let me just describe how I set it up in my test to see if it corresponds.
I have a parent post type and a child post type.
The CRED form publishes child posts. It includes the parent selector field (which is a field '_wpcf_belongs_parent-slug_id'). It sends a notification when the post is published that uses each of the %% placeholder fields for testing. The CRED form is added to a page.
I have a content template for displaying parent posts. In that template I insert a link to the child CRED form using the cred_child_link_form shortcode, specifying the page where the child CRED form is added (the ID of which gets added as the 'form' attribute).
Now when I view a parent post there is a link to publish a child post. Clicking this link takes me to the page with the CRED form, with a URL parameter added which specifies the ID of the parent post.
That is then used by the CRED form to pre-select the parent in the parent selector field.
For the notification placeholders for the parent post to work, the parent selector field must be included in the form (and set when submitted). What I've described above means that the parent is already selected when the form to create a child post is loaded, but it could be set manually, too.
Perhaps you can see from the above what is missing in your set up.
Hi Nigel,
Indeed my inquiry CP is child of my listing (ad) CP.
For the time being, my inquiry CRED form is not linked to any static page as it is directly opened in a popup window. The link to said CRED form in my layout (for the parent listing CP) reads as follows: [cred_form form="question-annonce"], without any mention to a parent or child post; also, the popup code is directly embedded in the CRED form.
When I try instead to create a child form link, as described in https://toolset.com/documentation/user-guides/cred-forms-for-child-content, it does not work as the field 'Page that contains the form' remains empty, which then prevents me to save the link. (although for the sake of the test I have created a static page containing said CRED form).
I am a bit at a loss there.
When you try to insert the cred_child_link_form shortcode and the dialog expects the page where the child form is added, if you start typing the name of the page then it should give you some auto-complete-style options to choose from.
The key is that the child form needs to have the field to select the parent, and if you add the child form in the way described then the parent will be pre-selected. (If you auto-generate the child post form markup the parent selector field will be added automatically.)
But, that is not how you are using the form in any case, you are adding it to the same page as the parent, albeit in a pop-up, right?
So, if you are inserting the child form directly into the template for the parent post using the cred_form shortcode, then you need to make a slight adjustment to the form.
Find the parent selector field in your form ('_wpcf_belongs_parental-unit_id' in my example) and then set the value to be the current post ID (which will be the post of the parent where the form is being displayed), like so:
[cred_field field='_wpcf_belongs_parental-unit_id' value='[wpv-post-id]' select_text='--- not set ---' class='form-control' output='bootstrap']
Does that make sense?
If not let me know and I'll set up a private reply so I can see for myself how you have set this up.
Hi Nigel,
Almost there! I have added the suggested code to my (child) CRED form and now the generated email displays all required field from the parent CP.
The only thing is that said code displays a selector field in the form itself (which is not needed) along with the parent CP title (which is a good thing), the whole thing being wrongly formatted (too narrow).
To get rid of the selector, I have tried to simplify your code as follows
If the problem now is just hiding the parent selector (which you must include in the form) just modify the markup of the form where the field is inserted and add a custom CSS rule to hide it, something like:
// This is in your form
<div class="hide-me">
[cred_field field='_wpcf_belongs_parental-unit_id' value='[wpv-post-id]' select_text='--- not set ---' class='form-control' output='bootstrap']
</div>
// This is the custom CSS
.hide-me {
display: none;
}