CRED plugin allows you to build front-end forms for creating and editing content. These forms can include all the fields that belong to the content and display them with your HTML styling. CRED forms also support input validation and automatic email notifications.
When you ask for help or report issues, make sure to tell us the structure and the settings of your form.
Viewing 15 topics - 676 through 690 (of 736 total)
Problem: I have a Commerce Form that is used to publish a post and connect it to an Order. The Commerce Form is configured to publish the post when the Order is completed. However, sometimes clients submit the same Form multiple times for the same Order. In this case, several posts are created but only the most recent post is published when the Order is completed. I would like to publish all the posts connected to the Order when the Order is completed.
Solution: Forms Commerce is not designed to support more than one post per Order, so custom code is required to make this work. See the example here using the cred_commerce_after_order_completed API:
// publish all posts created when one commerce form is submitted mutliple times in the same order
add_action( 'cred_commerce_after_order_completed', 'publish_all_ordered_posts', 10, 1 );
function publish_all_ordered_posts( $data ) {
// which order was completed?
$order_id = $data['transaction_id'];
// which posts were created in this order?
$all_order_posts = get_post_meta( $order_id, '_cred_post_id');
// loop over all the created posts
if( !is_array( $all_order_posts ) )
return;
foreach( $all_order_posts as $all_order_post ) {
// check the post status
$this_post_status = get_post_status( $all_order_post );
// publish any unpublished posts
if ( $this_post_status != 'publish' ) {
$args = array(
'ID' => $all_order_post,
'post_status' => 'publish'
);
wp_update_post( $args );
}
}
}
Problem:
Automatically selecting the post to add a RFG to, in front-end form
Solution:
you can use the Toolset Form's hook "cred_save_data" and to set/connect the parent post, you can use the post-relationship API function: toolset_connect_posts()
Problem:
The user would like to display some fields, on a form, when a relationship field has a value.
Solution:
Currently, Forms do not have a way to conditionally display fields based on a "relationship" field. We can work around this limitation with a custom Javascript code