Forum Replies Created

Viewing 15 replies - 31 through 45 (of 120 total)
  • Thread Starter netzgestaltung

    (@netzgestaltung)

    One Bug i maybe found was that when i did “Save Draft” 3 of 4 Maps to taxonomies connected to a filter where not saved.

    Instead they where saved as connected to a select menu.
    After selecting the filters back and saving, another 2 where saved.
    Then i selected the last one again as filter and now it is also saved.

    I think there might be some JS errors with an array or something similar.

    It changes the mapping between published and draft state, its always something different.

    Screenshot:

    Code that might work out, but i can’t test it:

    add_filter('cf7_2_post_filter-my_taxonomy_1','myPlugin_filter_cf7_my_taxonomy_1',10,3);
    add_filter('cf7_2_post_filter-my_taxonomy_2','myPlugin_filter_cf7_my_taxonomy_2',10,3);
    add_filter('cf7_2_post_filter-my_taxonomy_3','myPlugin_filter_cf7_my_taxonomy_3',10,3);
    add_filter('cf7_2_post_filter-my_taxonomy_4','myPlugin_filter_cf7_my_taxonomy_4',10,3);
    
    /**
     * Filter for mapping a dynamic dropdown to a taxonomy
     *
     * You need to name the fields like the slugs of the taxonomy to get this to work.
     *
     * @plugin  Post My CF7 Form  
     *          https://www.ads-software.com/plugins/post-my-contact-form-7/
     *
     * @plugin  Smart Grid-Layout Design for Contact Form 7  
     *          https://www.ads-software.com/plugins/cf7-grid-layout/
     *          get term by slug
     *          https://developer.www.ads-software.com/reference/functions/get_term_by/
     *
     * @see     idea and howto
     *          https://www.ads-software.com/support/topic/map-dynamic-dropdown-taxonomies-to-taxonomies/#new-topic-0
     *
     * @param   $taxonomy_slug is the slug of the taxonomy which terms should be mapped
     * @param   $value         is the post field value to return, by default it is empty. If you are filtering a taxonomy you can return either slug/id/array.  in case of ids make sure to cast them integers.(see https://codex.www.ads-software.com/Function_Reference/wp_set_object_terms for more information.)
     * @param   $post_id       is the ID of the post to which the form values are being mapped to
     * @param   $form_data     is the submitted form data as an array of field-name=>value pairs
     */
    function myPlugin_filter_cf7_post_taxonomy($taxonomy_slug, $value, $post_id, $form_data){
      $field_name = 'dynamic_select-' . $taxonomy_slug;
        
      if ( isset($form_data[$field_name]) && !empty($form_data[$field_name]) ) {
        $term = get_term_by('slug', $form_data[$field_name], $taxonomy_slug);
        $value = $term->term_id;
      }
      return $value;
    }
    function myPlugin_filter_cf7_my_taxonomy_1($value, $post_id, $form_data){
      return myPlugin_filter_cf7_post_taxonomy('my_taxonomy_1', $value, $post_id, $form_data);
    }
    function myPlugin_filter_cf7_my_taxonomy_2($value, $post_id, $form_data){
      return myPlugin_filter_cf7_post_taxonomy('my_taxonomy_2', $value, $post_id, $form_data);
    }
    function myPlugin_filter_cf7_my_taxonomy_3($value, $post_id, $form_data){
      return myPlugin_filter_cf7_post_taxonomy('my_taxonomy_3', $value, $post_id, $form_data);
    }
    function myPlugin_filter_cf7_my_taxonomy_4($value, $post_id, $form_data){
      return myPlugin_filter_cf7_post_taxonomy('my_taxonomy_4', $value, $post_id, $form_data);
    }
    Thread Starter netzgestaltung

    (@netzgestaltung)

    Thanks for FAQ #3

    I saw that the one filter that was in the published map did already create new terms with the delivered slug. So i think the filter variant will work out for good.

    getting the ID of the tag by slug is not a big deal. I will post my final code here, when i’m done.

    Thread Starter netzgestaltung

    (@netzgestaltung)

    Looks like id did not save all mappings AND i can’t edit the mapping after published.

    How can i edit or remove the mapping?

    Thread Starter netzgestaltung

    (@netzgestaltung)

    This is my attempt, the terms are generating new ones and don’t get assigned, so maybe i have to get the IDs instead of the slugs?

    also the generated filte names only shows one time also the post_type name. i don’t know why it once offered cf7_2_post_filter-my_post_type-my_taxonomy_2 and the other ones with cf7_2_post_filter-my_taxonomy_1

    
    add_filter('cf7_2_post_filter-my_taxonomy_1','myPlugin_filter_cf7_my_post_type_my_taxonomy_1',10,3);
    add_filter('cf7_2_post_filter-my_post_type-my_taxonomy_2','myPlugin_filter_cf7_my_post_type_my_taxonomy_2',10,3);
    add_filter('cf7_2_post_filter-my_taxonomy_3','myPlugin_filter_cf7_my_post_type_my_taxonomy_3',10,3);
    add_filter('cf7_2_post_filter-my_taxonomy_4','myPlugin_filter_cf7_my_post_type_my_taxonomy_4',10,3);
    
    /**
     * Filter for mapping a dynamic dropdown to a taxonomy
     *
     * You need to name the fields like the slugs of the taxonomy to get this to work.
     *
     * @plugin  Post My CF7 Form  
     *          https://www.ads-software.com/plugins/post-my-contact-form-7/
     *
     * @plugin  Smart Grid-Layout Design for Contact Form 7  
     *          https://www.ads-software.com/plugins/cf7-grid-layout/
     *
     * @see     idea and howto
     *          https://www.ads-software.com/support/topic/map-dynamic-dropdown-taxonomies-to-taxonomies/#new-topic-0
     *
     * @param   $taxonomy_slug is the slug of the taxonomy which terms should be mapped
     * @param   $value         is the post field value to return, by default it is empty. If you are filtering a taxonomy you can return either slug/id/array.  in case of ids make sure to cast them integers.(see https://codex.www.ads-software.com/Function_Reference/wp_set_object_terms for more information.)
     * @param   $post_id       is the ID of the post to which the form values are being mapped to
     * @param   $form_data     is the submitted form data as an array of field-name=>value pairs
     */
    function myPlugin_filter_cf7_post_taxonomy($taxonomy_slug, $value, $post_id, $form_data){
      $field_name = 'dynamic_select-' . $taxonomy_slug;
        
      if ( isset($form_data[$field_name]) && !empty($form_data[$field_name]) ) {
        $value = $form_data[$field_name];
      }
      return $value;
    }
    function myPlugin_filter_cf7_my_post_type_my_taxonomy_1($value, $post_id, $form_data){
      return myPlugin_filter_cf7_post_taxonomy('my_taxonomy_1', $value, $post_id, $form_data);
    }
    function myPlugin_filter_cf7_my_post_type_my_taxonomy_2($value, $post_id, $form_data){
      return myPlugin_filter_cf7_post_taxonomy('my_taxonomy_2', $value, $post_id, $form_data);
    }
    function myPlugin_filter_cf7_my_post_type_my_taxonomy_3($value, $post_id, $form_data){
      return myPlugin_filter_cf7_post_taxonomy('my_taxonomy_3', $value, $post_id, $form_data);
    }
    function myPlugin_filter_cf7_my_post_type_my_taxonomy_4($value, $post_id, $form_data){
      return myPlugin_filter_cf7_post_taxonomy('my_taxonomy_4', $value, $post_id, $form_data);
    }
    Thread Starter netzgestaltung

    (@netzgestaltung)

    Yes looks better now.

    Instead i currently get one new warning on every page backend/frontend:

    Warning	Trying to get property 'query_vars' of non-object	1	
    
        wp-includes/template.php:712
        load_template('wp-content/plugins/wp-post-comment-rating/inc/admin-setting.php')
        wp-content/plugins/wp-post-comment-rating/wpcr-comment-rating.php:99

    You can test yourself with the plugin Query Monitor

    Thread Starter netzgestaltung

    (@netzgestaltung)

    When your scripts are added, do they load from your domain or from my WordPress Site?

    When they connect the client directly to your domain and THEN ask for a consent, its far too late. You say that no third party connection is opened but the data is stored at HubSpot – how is this technically possible? Because on my WordPress Site HubSpot IS the third-party.

    I looked into your suggested Community page but no answers there.
    I think you should go fast to integrate with the suggested Consent API here:

    https://community.hubspot.com/t5/APIs-Integrations/Conforming-to-Consent-API-for-WordPress/m-p/351969

    Please don’t mark something as resolved that is not.

    Thread Starter netzgestaltung

    (@netzgestaltung)

    So this is to setup inside of HubSpot (where i as website developer have no access to)? and then your Plugin shows that up? Or is this somehow stored into WordPress so no third-party connection is necessary?

    Do you think this is somehow legal to connect to your service before the user has given consent to that?

    Plugin Contributor netzgestaltung

    (@netzgestaltung)

    Yes, they are gone. The markup stayed, only a minor issue then.
    Thank you!

    Plugin Contributor netzgestaltung

    (@netzgestaltung)

    Hi,

    not with the current development, but its also visible on another page:
    https://www.schlange-co.com/en/profile/ -> scroll down and click on “Please contact us for additional information”. inspect the form with the browser debugger, look also for Network analyses.

    Br,
    tom

    Thread Starter netzgestaltung

    (@netzgestaltung)

    I tested the update on another page, looks like it works now.

    Thanks for the quick response.

    Br,
    tom

    Thread Starter netzgestaltung

    (@netzgestaltung)

    I tested at on page with that code that worked out:

    add_action('admin_enqueue_scripts', 'myPlugin_jcf_admin_fix');
    function myPlugin_jcf_admin_fix(){
      $screen = get_current_screen();
      if ( in_array($screen->id, array('settings_page_jcf_admin', 'settings_page_jcf_fieldset_index')) ) {
        wp_enqueue_script('jquery-migrate');
      }
    }
    Thread Starter netzgestaltung

    (@netzgestaltung)

    And while writing this, Query monitor outputs a deprecated notice:

    Deprecated Array and string offset access syntax with curly braces is deprecated

    at

    .../wp-content/plugins/just-custom-fields/core/JustField.php:326

    Plugin Contributor netzgestaltung

    (@netzgestaltung)

    Hi,

    sorry i was late with my work this week.

    yes it works now!

    Plugin Contributor netzgestaltung

    (@netzgestaltung)

    interestingly i cant download from github it says: 500 internal server error when i open the zip or tar.gz file

    Plugin Contributor netzgestaltung

    (@netzgestaltung)

    I will check it until monday.

    Thanks for your effort!

    For the CF7 “Bug” – I as far as i know this is not a bug.

    They moved out default support for RSC in some Version and instead left the option to add it as Config, as documented here https://contactform7.com/2015/09/17/contact-form-7-43/ and here https://contactform7.com/captcha/

Viewing 15 replies - 31 through 45 (of 120 total)