fredr
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Cannot validate dates in my form after I write conditions for the datepickers
Started by: fredr in: Toolset Professional Support |
2 | 13 | 3 years, 9 months ago | ||
Create a form with dates conditions + send notification at those dates
Started by: fredr
in: Toolset Professional Support
Problem: I would like to trigger an automatic notification from a Form using custom date fields. Solution: See Nigel's example code in the following ticket. Relevant Documentation: |
2 | 7 | 3 years, 9 months ago | ||
Unique user field value form to prevent duplicate values
Started by: fredr
in: Toolset Professional Support
Problem: The issue here is that the user wanted to ensure that only unique values can be entered into their custom field on their frontend form. This means that 2 users can't have the same values in the custom fields. Solution: You can use the Toolset forms Validation hook to do this. Add the following hook to your Toolset custom code section in Toolset->Custom Codes and enable it /** * CRED custom validation to prevent duplicates CREATE FORM */ add_filter( 'cred_form_validate', 'prevent_duplicate_submissions_registration' ,10,2); function prevent_duplicate_submissions_registration( $error_fields, $form_data) { $nickname = $_POST['wpcf-form-field']; // Gets value from form $unique_field = 'wpcf-field-name'; // Meta key stored in db $form_ids = array( 69696969 ); // Edit IDs of CRED forms list( $fields,$errors ) = $error_fields; if ( in_array($form_data['id'], $form_ids ) ) { // Get existing posts with unique field $args = array( 'meta_key' => $unique_field, 'meta_value' => $nickname, 'meta_compare' => '=' , ); $matching = new WP_User_Query( $args ); $results = $matching->get_results(); if ( !empty( $results ) ) { $errors[ $unique_field ] = $nickname . ' is already in use. Choose a different name.'; } } return array($fields,$errors); }; /** * CRED custom validation to prevent duplicates EDIT FORM - excludes current user from the query as it will find a matching nickname */ add_filter( 'cred_form_validate', 'prevent_duplicate_submissions' ,10,2); function prevent_duplicate_submissions( $error_fields, $form_data) { $current_user = get_current_user_id(); $nickname = $_POST['wpcf-form-field']; // Gets value from form $unique_field = 'wpcf-field-name'; // Meta key stored in db $form_ids = array( 420420 ); // Edit IDs of CRED forms list( $fields,$errors ) = $error_fields; if ( in_array($form_data['id'], $form_ids ) ) { // Get existing posts with unique field $args = array( 'meta_key' => $unique_field, 'meta_value' => $nickname, 'meta_compare' => '=' , 'exclude' => $current_user ); $matching = new WP_User_Query( $args ); $results = $matching->get_results(); if ( !empty( $results ) ) { $errors[ $unique_field ] = $nickname . ' is already in use. Choose a different name.'; } } return array($fields,$errors); }; Note this is for a user form and will need to be customized to work for posts, however in the case of a user form you will need to change the wpcf-form-field and wpcf-field-name to the slug of the field that you want to prevent the duplicate on while keeping the wpcf- prefix on the field slug. |
2 | 12 | 3 years, 10 months ago | ||
Unable to create a view
Started by: fredr in: Toolset Professional Support |
3 | 6 | 4 years, 1 month ago | ||
Access seems not to work anymore with Divi
Started by: fredr
in: Toolset Professional Support
Problem: [toolset_access] shortcode does not work in Divi builder. Solution: It seems to be a compatibility problem, I have tried the same codes in another page without Divi builder, it works fine. Relevant Documentation: |
2 | 7 | 5 years, 6 months ago | ||
Making front end forms for repeating field groups work
Started by: fredr
in: Toolset Professional Support
Problem: After submit the post form for creating repeating field group item, redirect to the original post. Solution: See detail steps here: Relevant Documentation: |
2 | 4 | 6 years, 3 months ago | ||
Unable to update types and views
Started by: fredr
in: Toolset Professional Support
Problem: Solution: You can find proposed solution in this case with the following reply: Relevant Documentation: |
2 | 3 | 6 years, 5 months ago | ||
Activating wp-types -> http error500 when trying to create new content
Started by: fredr
in: Toolset Professional Support
Problem: The issue here is that the user is getting the WSOD when enabling the Types plugin. Solution: This can be done by following the instructions in the link below. Once you have done this then it should indicate to you what is causing the issue. |
2 | 3 | 6 years, 7 months ago | ||
filters do not work anymore in many-to-many relationships after update
1
2
Started by: fredr
in: Toolset Professional Support
Problem: Views filter on custom checkboxes field does not work in Types 3.0 + Veiws 2.6 Solution: There is an issue with the Checkbox fields that save “0” when they are not set on a post. Our developers have provide a errata for this: Relevant Documentation: |
3 | 20 | 6 years, 7 months ago |