Silvia
Support threads created in the last 30 days: 0
Favorite Forum Topics
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Help with migrating custom code provided by Support
Started by: Silvia
in: Toolset Professional Support
Problem: I have some post relationships custom code in place on my site, and the migration process indicates that it may cause problems. Solution: It's a good idea to check with support for migrating relationship code. This code should be okay, because we built in backwards compatibility for this particular case. |
2 | 5 | 5 years, 9 months ago | ||
Form notification to email from parent post field no longer working after Types 3.0 update
Started by: thomasD-2
in: Toolset Professional Support
Problem: I have a Form that triggers an email notification. I send the notification to an email address that is stored in a parent post's custom field, by using the CRED API cred_notification_recipients. Since updating to Types 3.0, the email notifications are not sent as expected. Solution: Update the code to work with the new Post Relationships API, and ensure the child post status is not "private". add_filter('cred_notification_recipients', 'modify_recipients', 10, 4); function modify_recipients($recipients, $notification, $form_id, $post_id) { // Check notification name matches target notification if ( isset($notification['name']) && 'Mail an Veranstalter' == $notification['name'] ) { // Add email recipient $parent_id = toolset_get_parent_post_by_type( $post_id, 'veranstaltung' ); $email_of_organizer = get_post_meta($parent_id, 'wpcf-veranstalter-email', true); $recipients[] = array( 'to' => 'cc', 'address' => '$email_of_organizer', 'name' => '', 'lastname' => '' ); } return $recipients; } Relevant Documentation: |
2 | 5 | 5 years, 10 months ago | ||
CRED-notification to email from parent post field
Started by: thomasD-2
in: Toolset Professional Support
Problem: I would like to send a CRED notification to an email address that is stored in a custom field on the CRED post's parent post. How can I access that parent post field in the CRED notification recipients configurations? Solution: Within the callback, you can figure out the parent post by calling get_post_meta on the child post, and accessing a hidden field that relates a parent post ID to the child post. The name of that field follows the format "_wpcf_belongs_" + parent post type slug + "_id". So if your parent post type slug is "event", then the postmeta key is "_wpcf_belongs_event_id" and the code is: $parent_id = get_post_meta($post_id, '_wpcf_belongs_event_id', true); Once you know the parent post ID, use it to call get_post_meta again on the parent post to retrieve the email field value. Types fields use the prefix "wpcf-" in the postmeta table, so if your email field slug is "email-address-of-organizer" then the code would look like this: $email_of_organizer = get_post_meta($parent_id, 'wpcf-email-address-of-organizer', true); Now the variable $email_of_organizer contains the email address from the parent post. Use that to modify the code sample on the API documentation page to fit your needs. Relevant Documentation: |
2 | 15 | 6 years, 3 months ago | ||
Change CP Author on Frontend
Started by: julieP
in: Toolset Professional Support
Problem: I would like to use a CRED generic field to display users, and modify the author of the created post to match the selected user. Solution: Using a View to create options for a generic field is not a supported feature of Views. The steps other users have had luck with are described below, but not guaranteed to work. Create a View of all Users: [wpv-layout-start] [wpv-items-found] <!-- wpv-loop-start --> <wpv-loop> [wpv-item index=1] {"value":"[wpv-user field="ID"]","label":"[wpv-user field="display_name"]"} [wpv-item index=other], {"value":"[wpv-user field="ID"]","label":"[wpv-user field="display_name"]"} </wpv-loop> <!-- wpv-loop-end --> [/wpv-items-found] [wpv-layout-end] Add code to functions.php which will strip extra formatting from the authors View: add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 ); function prefix_clean_view_output( $out, $id ) { if ( $id == '131' ) { //Please adjust to your Views ID $start = strpos( $out, '<!-- wpv-loop-start -->' ); if ( $start !== false && strrpos( $out, '<!-- wpv-loop-end -->', $start ) !== false ) { $start = $start + strlen( '<!-- wpv-loop-start -->' ); $out = substr( $out , $start ); $end = strrpos( $out, '<!-- wpv-loop-end -->' ); $out = substr( $out, 0, $end ); } else { $start = strpos( $out, '>' ); if ( $start !== false) { $out = substr( $out, $start + 1 ); $end = strpos( $out, '<' ); $out = trim(substr( $out, 0, $end )); } } } return $out; } Create a CRED generic field and place the authors View in the options attribute: [cred_generic_field field='change_post_author' type='select' class='' urlparam=''] { "required":0, "validate_format":0, "default":[], "options":[ [wpv-view name="All Authors"] ] } [/cred_generic_field] Add cred_save_data hook to functions.php: add_action('cred_save_data', 'my_save_data_action',10,2); function my_save_data_action($post_id, $form_data) { // if a specific form if ($form_data['id']==131) { $my_post = array( 'ID' => $post_id, 'post_author' => $_POST['change_post_author'] ); // Update the post in the database wp_update_post( $my_post ); } } |
2 | 3 | 6 years, 9 months ago | ||
WEIRD DISPLAY OF CHECKBOXES TEXT AND VALUES IN BACKEND
Started by: Silvia in: Toolset Professional Support |
2 | 12 | 7 years ago | ||
Multiple field "email" or "phone" : each instance associated to its proper owner
Started by: Silvia
in: Toolset Professional Support
Problem: Solution: <!-- wpv-loop-start --> <table width="100%"> <tbody class="wpv-loop js-wpv-loop"> <wpv-loop> <tr> <td>[types field="name" separator="<br>"][/types]</td> <td>[types field="phone" separator="<br>"][/types]</td> </tr> </wpv-loop> </tbody> </table> <!-- wpv-loop-end --> 5. Note the separator, it's a HTML break <br> to bring each instance of the same field on a new line. You can also use or-each ShortCode and Item ShortCode. Relevant Documentation: |
3 | 4 | 8 years, 2 months ago | ||
Query record with count
Started by: kelvinL-2
in: Toolset Professional Support
Problem: Solution (include the steps to follow here): function user_posts_count($atts) { return count_user_posts($atts["user-id"], $atts["post-type"]); } add_shortcode( 'user-post-count', 'user_posts_count' ); Register the ShortCode in Views > Settings > Compatibility > 3rd party ShortCodes and then use it in your View listing Users as this: [user-post-count user-id="[wpv-user field='ID']" post-type="post"] Above will return the count of Posts a certain (in Loop) user has created. |
2 | 5 | 8 years, 5 months ago | ||
Cred Form problems NOT RESOLVED AT ALL
Started by: Silvia in: Toolset Professional Support |
2 | 14 | 9 years, 9 months ago | ||
Cred Form problems
Started by: Silvia in: Toolset Professional Support |
2 | 6 | 9 years, 9 months ago |
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Building an order form
1
2
Started by: Silvia in: Toolset Professional Support |
2 | 22 | 6 months ago | ||
Create an image gallery from toolset image field In Breakdance Builder Template
Started by: Silvia in: Toolset Professional Support |
2 | 5 | 9 months, 1 week ago | ||
Name of relationship post alongside Post Title in pre-selected form field
Started by: Silvia in: Toolset Professional Support |
2 | 13 | 10 months ago | ||
Highlight post in table view if the post has children in a specific relationship
Started by: Silvia in: Toolset Professional Support |
2 | 10 | 11 months, 2 weeks ago | ||
ODD TOOLSET BEHAVIOURS
Started by: Silvia in: Toolset Professional Support |
2 | 8 | 11 months, 3 weeks ago | ||
Adjust content of relationship field in cred form
Started by: Silvia in: Toolset Professional Support |
2 | 9 | 1 year, 10 months ago | ||
Sorting view results by parent custom field or parent post title
Started by: Silvia
in: Toolset Professional Support
Problem: Sort child posts by custom fields of parent post type. Solution: There isn't such kind of built-in feature within Toolset plugins, Toolset Blocks/Views plugins are using WordPress class WP_Query to query posts, see WP document: https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters ‘meta_value‘ – Note that a ‘meta_key=keyname‘ must also be present in the query. That means you can only sort the results by custom fields of post type(“Institutional position”) you are querying, you can not sort the result by custom fields of other post type(“People”). As a workaround, you can try with a nested views, for example: Relevant Documentation: |
2 | 13 | 1 year, 11 months ago | ||
Featured Image box disappeared
Started by: Silvia in: Toolset Professional Support |
3 | 14 | 2 years, 1 month ago | ||
Automatically set parent CPT when creating a new article
Started by: Silvia in: Toolset Professional Support |
1 | 2 | 2 years, 10 months ago | ||
View in Archive page not rendering when showing CPT results
Started by: Silvia in: Toolset Professional Support |
2 | 7 | 3 years, 1 month ago | ||
Include parent custom field value in form notification
Started by: Silvia
in: Toolset Professional Support
Problem: Solution: You can find the proposed solution in this case with the following reply: Relevant Documentation: |
2 | 5 | 3 years, 1 month ago | ||
Markers not appearing on map in Archive page (Real Estate Reference site)
Started by: Silvia in: Toolset Professional Support |
2 | 4 | 3 years, 2 months ago | ||
Filter a view by a custom field in the PARENT CPT
Started by: Silvia in: Toolset Professional Support |
2 | 3 | 3 years, 11 months ago | ||
PARENT_POST_TITLE not working in email send by form
1
2
Started by: Silvia
in: Toolset Professional Support
Problem: I would like to include the parent post title in an email notification triggered by a Form that creates private child posts. Unfortunately the %%PARENT_POST_TITLE%% placeholder is not working as expected. Solution: The best solution here is to create custom placeholders using the Forms API, and use the post relationships API in those placeholders to display information from the parent post. add_filter('cred_body_notification_codes', 'custom_generic_field_notification'); add_filter('cred_subject_notification_codes', 'custom_generic_field_notification'); function custom_generic_field_notification( $defaultPlaceHolders ) { $parent_id = $_REQUEST['@book-chapter_parent']; $newPlaceHolders = array( '%%FIXED_PARENT_TITLE%%' => get_the_title($parent_id), '%%FIXED_PARENT_LINK%%' => get_permalink($parent_id) ); return array_merge($defaultPlaceHolders, $newPlaceHolders ); } Then in your notification you can use them like other placeholders: Parent post title: %%FIXED_PARENT_TITLE%% Parent post link: %%FIXED_PARENT_LINK%% In your case you would change @book-chapter_parent to match your post relationship slug. Yours would be @tessuti_richiesta-info_parent. Notice that the "dot" usually seen in the post relationship slug is replaced with an underscore here. Relevant Documentation: |
2 | 17 | 4 years, 2 months ago | ||
Grant/revoke access to image visibility based on user
1
2
3
Started by: Silvia
in: Toolset Professional Support
Problem: Solution: The core idea of this code is explained here: |
2 | 35 | 4 years, 2 months ago |