ioannisM-2
Support threads created in the last 30 days: 0
Favorite Forum Topics
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Favorite Posts By Logged In User (Add To / Remove not working properly)
1
2
Started by: Team DNK
in: Toolset Professional Support
Problem: I would like Users to be able to choose certain posts as favorites. They should also be able to remove them from favorites. Solution: Create a CRED form that allows you to modify the posts that can be favorited. Remove all the content from the CRED form and replace it with the following code: [credform class='cred-form cred-keep-original'] [wpv-conditional if="( [toolset_is_favorite id='[wpv-post-id]'] eq '1' )"] [cred_generic_field field='remove-favorite' type='hidden' class=''] { "required":0, "validate_format":0, "default":"1" } [/cred_generic_field] [/wpv-conditional] [cred_field field='form_submit' value='Favorite' urlparam='' class='x-btn x-btn-global mam'] [/credform] Add the following JavaScript to your CRED form's JS panel: jQuery(window).bind("load", function() { jQuery( "form[id^='cred_form_368']").find("input[type='submit']").val(jQuery( "input[name='remove-favorite']").length ? "Remove from Favorites" : "Add to Favorites"); } ) This code will toggle between showing "Add to Favorites" and "Remove from Favorites" as the button name. Add the following PHP to your child theme's functions.php file: add_action('cred_save_data_368', 'sda_user_favorites',10,2); function sda_user_favorites($post_id, $form_data) { if( isset($_REQUEST['remove-favorite']) ) { delete_post_meta($post_id, 'wpcf-favorites', get_current_user_id()); } else { add_post_meta($post_id, 'wpcf-favorites', get_current_user_id(), false); } } /* Favorites shotcode for use as a conditional */ add_shortcode( 'toolset_is_favorite', 'toolset_is_favorite_func'); function toolset_is_favorite_func($atts) { global $wpdb; $post_id = $atts['id']; $user_id = get_current_user_id(); $favorites = $wpdb->get_results( "SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = $post_id AND meta_value = $user_id LIMIT 1"); return sizeof($favorites) ? 1 : 0; } Be sure to add the toolset_is_favorite shortcode in Toolset > Settings > Frontend content > 3rd party shortcode arguments. Place the CRED form in a View of posts, or in a Content Template for these posts. Relevant Documentation: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data |
3 | 19 | 6 years, 11 months ago | ||
How can I add complex CSS3 to CRED-form-fields?
Started by: philipG-3 in: Toolset Professional Support |
3 | 7 | 6 years, 12 months ago | ||
Pass URL Parameter
Started by: jamesH-8 in: Types Community Support |
2 | 4 | 7 years ago | ||
Display orders list for an user
Started by: luca-pietroU in: Toolset Professional Support |
4 | 8 | 7 years ago | ||
Checkout Woocommerce CRED Form
Started by: andreaD-4
in: Toolset Professional Support
Problem: I have added all the WooCommerce billing fields to Types control, and I would like to use CRED to capture that information when a new User is created. I am unable to use a select type field for country and state. Solution: It's not currently possible to modify the field type when you move a field into Types control. You would be required to use the correct two-letter abbreviations for Country and State as defined by WooCommerce. If you want to create custom select fields, you can use the cred_save_data hook to capture the selected values and store them in the billing fields. Relevant Documentation: http://creatingawebstore.com/woocommerce-country-codes-and-state-codes-list.html |
2 | 7 | 7 years, 1 month ago | ||
Compare current Form data with stored data
Started by: alanS3341
in: Toolset Professional Support
Problem: Solution: You will get the data from the $_POST and compare it as example on submit, or similar, with the data in the Database. |
2 | 3 | 7 years, 1 month ago | ||
Filter children by grandparent
1
2
Started by: Jeffrey
in: Toolset Professional Support
Problem: I have a 3-level custom post type relationship hierarchy - grandparent > parent > child. On my single grandparent post page, I would like to display a View of child posts, with a custom search filtered by parent. By default, all the children of the current grandparent should be displayed, and the user should be able to select a parent as a filter. Solution: There are two options: use a URL parameter and a post relationship filter, or use two nested Views. URL parameter approach: Create a View that shows child posts, filtered by Post Relationship (grandparent > parent). Set the filter query to respond to a URL parameter. Apply this URL parameter to all links to the grandparent single post page: Nested View approach: Create a View that shows child posts, filtered by post relationship, where the parent is the current post in the Loop. In the Loop Output, add the information you want to display about each child post. Then, create a View that shows parent posts, where all parents are children of the current grandparent post. Insert the child View into the Loop Output of the parent View. Relevant Documentation: https://toolset.com/documentation/user-guides/creating-post-type-relationships/ |
2 | 17 | 7 years, 2 months ago | ||
How to display CRED Generic checkboxes field with image as label
Started by: Timothy
in: Toolset Professional Support
Problem: Solution: You can find the proposed solution with the following reply: Relevant Documentation: |
2 | 15 | 7 years, 2 months ago | ||
Get new and previous value before save data
Started by: marcoR-6
in: Toolset Professional Support
Problem: Solution: add_action('cred_before_save_data', 'my_before_save_data_action',10,1); function my_before_save_data_action($form_data) { // if a specific form if ($form_data['id']==3780) { if (isset($_POST['_cred_cred_prefix_post_id'])) { $current_post_id = $_POST['_cred_cred_prefix_post_id']; // post id $field_old_value = get_post_meta( $current_post_id, 'wpcf-resolved-by', true ); // 'wpcf-resolved-by' Custom Field Slug $field_new_value = $_POST['wpcf-resolved-by']; // 'wpcf-resolved-by' Custom Field Slug echo 'Old Value '.$field_old_value ."<br>"; echo 'New Value '.$field_new_value ."<br>"; $args = array( 'post_type' => 'student', // CPT slug 'posts_per_page' => -1, // All Posts ); $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); if( get_the_ID() == $current_post_id ) // Ignore Current Edit post continue; $key_1_value = update_post_meta( get_the_ID(), 'wpcf-resolved-by', $field_new_value ); // // 'wpcf-resolved-by' Custom Field Slug endwhile; endif; // Reset Post Data wp_reset_postdata(); } }} ==> Please note the comments in the above code and replace your CRED form ID, Custom field slug, CPT slug, etc where needed. Relevant Documentation: |
2 | 3 | 7 years, 2 months ago | ||
Author page template
Started by: romanB-3
in: Toolset Professional Support
Problem: Solution: function get_user_id() { $author = get_user_by( 'slug', get_query_var( 'author_name' ) ); return $author->ID; } add_shortcode( 'get_user_id', 'get_user_id' ); 2. Register the ‘get_user_id’ shortcode first in Toolset >> Settings >> Front-end Content >> Third-party shortcode arguments. 3. Then use shortcode like this in the Author Archive View: [wpv-user field="user_login" id="[get_user_id]"] [wpv-user field="profile_picture" id="[get_user_id]"] WP Author Templates are below, currently we are talking about author.php: Relevant Documentation: |
2 | 7 | 7 years, 3 months ago | ||
Conditional cred notifications
Started by: romanB-3
in: Toolset Professional Support
Problem: cred_notification_recipients hook and how to use it? Solution: Relevant Documentation: |
3 | 13 | 7 years, 3 months ago | ||
How to use cred api
Started by: Roberto Spagnuolo in: Toolset Professional Support |
3 | 9 | 7 years, 3 months ago | ||
Automatic post creation on registration
Started by: martinN-3
in: Toolset Professional Support
Problem: Solution: You can find the proposed solution with the reply at here and here. Relevant Documentation: |
2 | 13 | 7 years, 3 months ago | ||
how to display taxonomy as radio button image filter
Started by: Kristen Estes
in: Toolset Professional Support
Problem: Solution: You can find the proposed solution with reply here Relevant Documentation: |
2 | 11 | 7 years, 3 months ago | ||
Pay per post
Started by: robertN-6 in: Toolset Professional Support |
2 | 3 | 7 years, 4 months ago |
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Toolset Custom Fields in Php not Working
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 7 | 6 years, 11 months ago | ||
Types Cred Compatibility with Transliteration Plugin
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 3 | 6 years, 12 months ago | ||
Rewrite Post Type Slug but with php
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 4 | 7 years ago | ||
How to Check Locale in a Conditional
Started by: ioannisM-2
in: Toolset Professional Support
Problem: Solution: [wpv-conditional if="( '[wpv-bloginfo show="language"]' eq 'en-US' )"] Language is english [/wpv-conditional] [wpv-conditional if="( '[wpv-bloginfo show="language"]' eq 'ar' )"] Language is Arabic [/wpv-conditional] Relevant Documentation: |
2 | 8 | 7 years ago | ||
Render WordPress Archive
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 4 | 7 years ago | ||
How to Mask Post Slug in Url with the Value of a Custom Field
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 3 | 7 years ago | ||
Performance Issue
Started by: ioannisM-2
in: Toolset Professional Support
Problem: Solution: This is usually done by activating/deactivating plugins and themes to see what is the issue source. If this narrows down to Toolset, please contact us. Relevant Documentation: |
3 | 9 | 7 years, 5 months ago | ||
Custom Shortcode, Parametric Search & Views
Started by: ioannisM-2 in: Toolset Professional Support |
3 | 14 | 7 years, 5 months ago | ||
Save Shortcode Value in Date Generic Field
Started by: ioannisM-2
in: Toolset Professional Support
Problem: Solution: add_shortcode('wpv-today-day', 'today_shortcode'); function today_shortcode($atts) { $current_date_time = date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 )); return $current_date_time; } Then in the CRED Edit User form, you can add this field as below: <div class="cred-field cred-field-time-of-editing-profile"> <label class="cred-label"> Time of editing profile </label> [cred_field field='time-of-editing-profile' post='user' value='[wpv-today-day]' urlparam='' readonly='true' placeholder='[wpv-today-day]' class='form-control' output='bootstrap'] </div> Alternate solution can be: |
2 | 10 | 7 years, 5 months ago | ||
Date Query Filter set by Custom Field
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 7 | 7 years, 5 months ago | ||
Cred & WPML Issue
1
2
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 24 | 7 years, 5 months ago | ||
How to check if the post author is logged in
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 10 | 7 years, 5 months ago | ||
Render Content Template – Image Url not displaying
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 3 | 7 years, 5 months ago | ||
Update Parent Field In Another Language
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 4 | 7 years, 6 months ago | ||
Update Field of Custom Post when user buys a product
Started by: ioannisM-2 in: Toolset Professional Support |
2 | 3 | 7 years, 6 months ago |