CRED plugin provides an API, making it easy to customize your post or user forms. The API includes hooks (actions and filters) to accomplish specific tasks using PHP code.
When you ask for help or report issues, make sure to tell us all related information about your form and what you want to achieve.
Viewing 15 topics - 826 through 840 (of 1,232 total)
Problem:
When inserting custom user fields in a Content Template the client could not see how to specify which user.
Solution:
When you insert a field using the Fields and Views button where applicable a tab is available to specify the data source (i.e. which user for user fields, which post for post fields).
Problem: I would like to disable AJAX image uploads in a Form, and I would like to rename the image file after upload.
Solution: There is not a built-in way to manage the uploaded filename, but you could use the cred_save_data hook to manipulate the filename manually with PHP. Then update the custom field value to match the URL of the updated filename.
Use the Forms API cred_file_upload_disable_progress_bar to disable AJAX file uploads:
add_filter("cred_file_upload_disable_progress_bar", "disable_progress_bar");
function disable_progress_bar($val) {
return true;
}
Problem:
I have two upload fields on CRED form, one for image file and one for pdf file type only.
I want to validate what users upload in each field. Solution:
add_filter('cred_form_ajax_upload_validate','my_validation',10,2);
function my_validation($error_fields, $form_data)
{
//field data are field values and errors
list($fields,$errors)=$error_fields;
//validate if specific form
if ($form_data['id']==5)
{
//if the file field is set, and not type jpeg
if (isset($fields['wpcf-toolset-file']['field_data']['type']) && $fields['wpcf-toolset-file']['field_data']['type'] != 'image/jpeg')
{
$errors['wpcf-toolset-file'] = 'Wrong file type';
}
//if the image field is set, and bigger than one
if (isset( $fields['wpcf-toolset-image']['field_data']['size'] ) && $fields['wpcf-toolset-image']['field_data']['size'] > 1)
{
$errors['wpcf-toolset-image'] = 'Wrong size image';
}
}
//return result
return array($fields,$errors);
}
Problem: I have a CRED form set up that allows users to update a post's status. The User can select a status that is different from the form's post status settings. Incorrect email notifications are being sent when the email status is different from the form's post status settings.
Solution: Change the form's post status settings to "Keep original status" to prevent these unnecessary draft emails from being sent.