|
Test if post has parent post of specific custom post type
Started by: romanB-3
in: Toolset Professional Support
|
|
2 |
4 |
7 years, 3 months ago
romanB-3
|
|
I updated all my Toolset plugins yesterday – and everything fails, i'm lost:-/
Started by: Bo Jensen
in: Toolset Professional Support
|
|
2 |
4 |
7 years, 3 months ago
Noman
|
|
Two custom Toolset codes are not working together
Started by: Arrien
in: Toolset Professional Support
|
|
2 |
13 |
7 years, 3 months ago
Arrien
|
|
Media attaching to post that contains the form rather than the form post type
Started by: markL
in: Toolset Professional Support
Quick solution available
Problem: When I insert an image into the body of a CRED post form, the image is inserted as expected but in the Media Library it shows as being attached to the page where the form is inserted. The image should be attached to the post being created by CRED.
Solution: The latest version of CRED, 1.9.1, includes a fix for this issue.
|
|
2 |
4 |
7 years, 3 months ago
markL
|
|
How to save checkbox custom field with CRED
Started by: SenaC7422
in: Toolset Professional Support
Quick solution available
|
|
2 |
3 |
7 years, 3 months ago
SenaC7422
|
|
Show product ID with link of bought product in cpt with cred commerce form
Started by: martinN-3
in: Toolset Professional Support
|
|
2 |
8 |
7 years, 3 months ago
martinN-3
|
|
using cred api with user registration to populate post as user is created. I wa
Started by: oliverD
in: Toolset Professional Support
Quick solution available
Problem: I am trying to test that my CRED API calls are being triggered but my JavaScript browser console messages are not showing up as expected.
Solution: Instead of trying to write to the JavaScript console by echoing script tags, try using the PHP error log:
function add_parent_inquiry1($post_id, $form_data){
error_log('You posted: add_parent_inquiry1'); // basic string
error_log($post_id . '<br />'); // you can append markup like this
error_log(print_r($form_data, true)); // log the contents of an array or associative array
}
Or, echo the information directly to the screen and call die(); to end PHP execution immediately.
Relevant Documentation: https://toolset.com/documentation/user-guides/debugging-toolset/
|
|
2 |
4 |
7 years, 3 months ago
oliverD
|
|
Conditional cred save data based on cred generic field
Started by: romanB-3
in: Toolset Professional Support
Quick solution available
Problem:
Add a condition in Cred save data function to check the radio button:
if it is set on "approve", then I update the post status from "1" to "2"
if it is set on "refuse", then I update the post status from "1" to "0"
Solution:
Please add this code in your theme’s or child theme’s functions.php file:
add_action('cred_save_data', 'prefix_cred_save_data', 10, 2);
function prefix_cred_save_data( $post_id, $form_data ){
if ($form_data['id']==1158){ //do the following code only if the CRED form ID is 1158, adjust this to your CRED form ID
if(isset($_POST['my-generic-field']) && $_POST['my-generic-field'] != '') { // If generic value is set
$generic_field_value = $_POST['my-generic-field'] == 'approve' ? 1 : 0; // if generic value is approve then return 1 otherwise 0
}
else {
$generic_field_value = 2; // If generic value is not set
}
update_post_meta($post_id, 'wpcf-etat-de-la-demande', $generic_field_value, true); // update custom field
}
}
==> Look for the comments in the above code and change your Form ID, Custom Field slug, etc as needed.
|
|
2 |
3 |
7 years, 3 months ago
romanB-3
|
|
3 times the same cred save data function, but only the 2 first work !
Started by: romanB-3
in: Toolset Professional Support
Quick solution available
Problem: I have 3 cred_save_data hooks that are used to update a custom field, but they do not seem to be working as expected.
Solution: Check to be sure the update_post_meta call is operating correctly. In this case, the 4th parameter was set as "true", which was causing problems with the update process.
Relevant Documentation: https://codex.wordpress.org/Function_Reference/update_post_meta
|
|
2 |
3 |
7 years, 3 months ago
romanB-3
|
|
Cred save data on existing field
Started by: romanB-3
in: Toolset Professional Support
Quick solution available
Problem: I would like to capture the value from a generic field using cred_save_data, and store it in a custom field.
Solution: Add the following code to functions.php:
add_action('cred_save_data', 'sauver_responsable_projet',10,2);
function sauver_responsable_projet($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==87)
{
if (isset($_POST['responsable-projet']))
{
update_post_meta($post_id, 'wpcf-responsable-projet', $_POST['responsable-projet'], true);
}
}
}
Create a generic field called 'responsable-projet' in your CRED form, and create a custom field called 'responsable-projet' in the post type associated with the CRED form.
Relevant Documentation:
https://toolset.com/documentation/user-guides/inserting-generic-fields-into-forms/
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
|
|
2 |
19 |
7 years, 3 months ago
romanB-3
|
|
Output filters of a view to a CRED form
Started by: romanB-3
in: Toolset Professional Support
Quick solution available
Problem: I would like to use the cred_save_data hook to capture the selected filters in a View.
Solution: Use the urlparam attribute on a CRED field to set the value of that field using a URL parameter. This only works on page load, and will not work with an AJAX update. You can write custom JavaScript and trigger it on certain events, like pagination and search results updates. The settings for these events can be found in the Advanced settings in your View editor.
Relevant Documentation: https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
|
|
2 |
5 |
7 years, 3 months ago
romanB-3
|
|
Query string on URL after CRED submit redirect
Started by: carletto0282
in: Toolset Professional Support
|
|
2 |
2 |
7 years, 3 months ago
Luo Yang
|
|
How to create multiple entries posts using CRED form
Started by: oliverD
in: Toolset Professional Support
Quick solution available
Problem:
How to create multiple entries posts using CRED form
Solution:
CRED forms can be attached to single post type and hence you can not create multiple entries using single CRED form BUT you can use CRED API hook cred_save_data to add your custom logic using which you can create multiple entries using CRED form.
You can use CRED hook: cred_save_data
Now, using above hook you can create child entry using the WordPress function - wp_insert_post :
You can find the proposed solution with the reply here
Relevant Documentation:
=> https://toolset.com/documentation/user-guides/cred-api/#csd
=> https://developer.wordpress.org/reference/functions/wp_insert_post/
|
|
2 |
8 |
7 years, 3 months ago
oliverD
|
|
Dynamic title of child post based on parent posts names
Started by: romanB-3
in: Toolset Professional Support
Quick solution available
Problem: I would like to use the cred_save_data hook to modify the title of the post using information from its parent posts. I can get the parent post IDs using _wpcf_belongs_slug_id, but I do not know how to get the title of those posts using the IDs.
Solution: Use the WordPress get_the_title() function to retrieve a post's title using the post's ID.
Relevant Documentation: https://developer.wordpress.org/reference/functions/get_the_title/
|
|
2 |
3 |
7 years, 3 months ago
romanB-3
|
|
Cannot compare to zero in cred_form_validate
Started by: nabils
in: Toolset Professional Support
|
|
2 |
4 |
7 years, 3 months ago
Christian Cox
|