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, 7 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, 7 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, 8 months ago | ||
Unable to create a view
Started by: fredr in: Toolset Professional Support |
3 | 6 | 3 years, 11 months 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, 5 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, 1 month 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, 3 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, 5 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, 5 months ago | ||
How to attribute content to a user who has created it while not logged ?
Started by: fredr
in: Toolset Professional Support
Problem: I would like for Guests to be able to create content on my site. Once the content is approved, then I would like for the guest to register as a User. At that point, I would like for the new User to be listed as the author of the post created earlier by the guest User. Solution: You could ask guests to fill in their email address when they submit content, but there's no guarantee that this will match up with the email address they use when they sign up or register. Then when they do register later, even if they use the same email address, there's not an automated way to retroactively assign them as author to the content they created. It sounds like automating this full process would require a significant amount of custom code. You'll need some way to associate guest authors with future users, and to automate the retroactive author assignment somehow. Otherwise the workflow will be fairly manual, because some Editor or Admin user will be required to manually go in and change the author of the posts created by Guests after the Guest signs up and becomes a User. If the email address provided earlier matches with the User's email address, it will be easy to do this from wp-admin. If it does not match, it will take some additional work to contact new Users and determine which should be the author. Relevant Documentation: https://toolset.com/documentation/user-guides/access-control-for-cred-forms/ |
2 | 3 | 7 years, 1 month ago | ||
I created a custom post type, and cannot create a cred form for it.
Started by: fredr
in: Toolset Professional Support
Problem: I have created a custom post type, but when I try to create a CRED form that will allow me to create posts, I cannot select my post type because it's not visible in the list of options. Solution: Check the post type options - it should be publicly queryable. |
2 | 3 | 7 years, 2 months ago |