erikO
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 |
---|---|---|---|---|---|
Unable to upload .png file format images using cred form.
Started by: erikO in: Toolset Professional Support |
2 | 2 | 3 years, 11 months ago | ||
Toolset Access on custom post
Started by: erikO
in: Toolset Professional Support
Problem: I would like to restrict access to posts using Toolset Access and a custom field on each post that stores a numeric User ID. The User whose ID is stored in the custom field should have access to the post, but no one else should. This doesn't seem to be working as expected. Solution: The "own" or ownership referred to in Access can only be defined as the post author, not a custom field value or any other association type. In other words, the post's author is the only owner of a post, as far as Access is concerned. If you'd like to use this Access feature to limit or allow editing of "own" posts, you must set each User as the author of their own post(s). To restrict access to editing posts with Forms, you must use the Toolset Forms tab in Toolset > Access Control to modify the access settings per Form. Relevant Documentation: |
2 | 3 | 4 years, 8 months ago | ||
Cred Form for a specific post type is not rendering on front end
Started by: erikO in: Toolset Professional Support |
2 | 5 | 5 years, 4 months ago | ||
Editing Custom Fields not accessible
1
2
Started by: erikO
in: Toolset Professional Support
Problem: Solution: Relevant Documentation: |
2 | 23 | 5 years, 8 months ago | ||
Looking for a way to target cred field ID
Started by: erikO in: Toolset Professional Support |
2 | 2 | 6 years, 1 month ago | ||
Query of child posts not returning results
Started by: erikO
in: Toolset Professional Support
Problem: I am trying to use WP_Query to get related posts using the new Toolset Post Relationships API, but the query is returning no results. If I use toolset_get_related_posts, I get the correct results. Solution: Be sure your code is executed after Toolset is ready. add_action( 'init', function(){ $test = new WP_Query( array( 'post_type' => 'service-tab', 'toolset_relationships' => array( 'role' => 'child', 'related_to' => 74, 'relationship' => 'service-service-tab' ), ) ); $tabs = $test->posts; }, 100); Relevant Documentation: |
2 | 13 | 6 years, 5 months ago | ||
Filter options for parent select field in Forms
Started by: erikO
in: Toolset Professional Support
Problem: I have a Form that allows Users to select a parent post, and I would like to filter the list of parent post options. Then I would like to associate the two posts using custom code. Solution: You can do this with a generic field, the cred_save_data API, and the toolset_connect_posts API. You must be sure to set the generic field to use the option "persist":1, like this: [cred_generic_field field='custom-parent-field' type='select' class='' urlparam=''] { "required":0, "validate_format":0, "default":[], "persist":1, "options":[ ...your explicit options here... ] } [/cred_generic_field] You can access a generic field value in the $_POST superglobal during the cred_save_data callback. You won't have access to the new post's ID in the cred_before_save_data callback. The new post hasn't been created yet, so no id yet. You'll need both post IDs to connect them in a relationship, so you will use cred_save_data instead. If your field has the name "custom-parent-field" then your callback would look like this: add_action('cred_save_data', 'cred_custom_callback_fn',10,2); function cred_custom_callback_fn($post_id, $form_data) { $forms = array( 1234 ); // if a specific form if (in_array($form_data['id'], $forms)) { if (isset($_POST['custom-parent-field'])) { $parent_id = $_POST['custom-parent-field']; $parent = toolset_connect_posts( 'relationship_slug', $parent_id, $post_id ); // your other callback code continues here } } } Replace custom-parent-field with the name of your generic field. Replace 1234 with the ID of the Form, or a comma-separated list of Form IDs if you want to apply this same logic to more than one Form. Replace relationship_slug with the actual slug of this relationship. Relevant Documentation: |
2 | 2 | 6 years, 6 months ago |