Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter alexbourlier

    (@alexbourlier)

    You’re the best, thanks!

    Small progress on my side : I’ve identified that the problem was coming from the Wordfence plugin. When a file is attached in the form, Wordfence’s firewall blocks it for a reason I could not understand.

    I tried to set an exception in Wordfence but couldn’t. I had to turn off the firewall completely.

    I can’t tell if the problem is on CF7 or Wordfence, but I’m willing to help debugging as much as necessary if you feel link fixing this one @takayukister

    If you consider Wordfence compatibility is out of the scope of your duty, I won’t try to take this one on on my own

    Hi Takayuki,

    I’m facing the same issue on this form:
    https://cdma.happy-dev.fr/candidater/?email=zeineb.abdelli%40greta-cdma.paris&formation=BMA%20%C3%A9b%C3%A9niste

    I had to revert back to version 5.3 of the plugin for it to work again.
    The form isn’t sent when I use 5.4.*
    I receive a non explicit 500 issue when I try to submit the form with a [file] field in my form with them.

    Thread Starter alexbourlier

    (@alexbourlier)

    Arf… The polylang plugin was actually the cause… Deactivating it solved the problem.

    Many thanks for your helped. Without your help, I would still be on it. Thanks!

    Thread Starter alexbourlier

    (@alexbourlier)

    Hmmm…

    This is how I implement relevanssi_modify_wp_query in function.php

    
    function modify_search($wp_query) {
      $wp_query->set('s', get_query_var('s'));// fetch search string
      $wp_query->set('post_type', 'formations');
      $wp_query->set('posts_per_page', 9);
      $wp_query->set('paged', $wp_query->query_vars['paged']);// paging
    
      // filtrer suivant la bonne taxonomy
      if (isset($_GET['taxonomy'])) {
        switch ($_GET['taxonomy']) {
          case 'formation-diplomantes-cpf':
            $ta = ['formation-diplomante', 'formation-eligible-au-cpf'];
            $op = 'AND';
          break;
    
          case 'toute-formation':
          break;
    
          default:
            $ta = $_GET['taxonomy'];
            $op = 'IN';
        }
    
        if (isset($ta)) {
          $tq = [[
            'taxonomy' => 'type_form',
            'field'    => 'slug',
            'terms'    => $ta,
            'operator' => $op,
          ]];// Tax Query
    
          $wp_query->set('tax_query', $tq);
        }
      }
    
      return $wp_query;
    }
    add_filter('relevanssi_modify_wp_query', 'modify_search');
    

    I get no result: https://cdma.happy-dev.fr/?s=design&taxonomy=toute-formation

    Even though $wp_query->query_vars seem correct to me. I’m echoing them from search.php:

    
    global $wp_query;
    print_r($wp_query->query_vars);
    

    Output:

    
    Array ( [s] => design [taxonomy] => toute-formation [error] => [m] => [p] => 0 [post_parent] => [subpost] => [subpost_id] => [attachment] => [attachment_id] => 0 [name] => [pagename] => [page_id] => 0 [second] => [minute] => [hour] => [day] => 0 [monthnum] => 0 [year] => 0 [w] => 0 [category_name] => [tag] => [cat] => [tag_id] => [author] => [author_name] => [feed] => [tb] => [paged] => 0 [meta_key] => [meta_value] => [preview] => [sentence] => [title] => [fields] => [menu_order] => [embed] => [category__in] => Array ( ) [category__not_in] => Array ( ) [category__and] => Array ( ) [post__in] => Array ( ) [post__not_in] => Array ( ) [post_name__in] => Array ( ) [tag__in] => Array ( ) [tag__not_in] => Array ( ) [tag__and] => Array ( ) [tag_slug__in] => Array ( ) [tag_slug__and] => Array ( ) [post_parent__in] => Array ( ) [post_parent__not_in] => Array ( ) [author__in] => Array ( ) [author__not_in] => Array ( ) [tax_query] => Array ( [0] => Array ( [taxonomy] => language [field] => term_taxonomy_id [terms] => 622 [operator] => IN ) [1] => Array ( [taxonomy] => language [field] => term_taxonomy_id [terms] => 622 [operator] => IN ) ) [ignore_sticky_posts] => [suppress_filters] => [cache_results] => 1 [update_post_term_cache] => 1 [lazy_load_term_meta] => 1 [update_post_meta_cache] => 1 [post_type] => formations [posts_per_page] => 9 [nopaging] => [comments_per_page] => 50 [no_found_rows] => [search_terms_count] => 1 [search_terms] => Array ( [0] => design ) [search_orderby_title] => Array ( [0] => gretacdma_posts.post_title LIKE '{cb793a21e7786cd73b23061f81ecde61c38e2f18a4e56af2c57586031d8c210b}design{cb793a21e7786cd73b23061f81ecde61c38e2f18a4e56af2c57586031d8c210b}' ) [order] => DESC [operator] => OR ) 
    
    Thread Starter alexbourlier

    (@alexbourlier)

    I understand better now. I was kind of doing it like that (via pre_get_post) but was facing that pagination issue, and searching for an answer I found a post of you saying having a query_posts in the pre_get_posts hook would screw things up, so I back pedaled from there and moved everything in search.php. I might have gotten it wrong though.

    I try your suggestion out and reach back. Thanks for your help!

    Thread Starter alexbourlier

    (@alexbourlier)

    Thank you for your response Mikko.

    The thing is that the code bypasses the search.php file on page 2 and gets straight to 404 response. relevanssi_do_query() is not called on that page then.

    $wp_query->query_vars is worth the following on the 404 page:

    
    => 0 [monthnum] => 0 [year] => 0 [w] => 0 [category_name] => [tag] => [cat] => [tag_id] => [author] => [author_name] => [feed] => [tb] => [meta_key] => [meta_value] => [preview] => [sentence] => [title] => [fields] => [menu_order] => [embed] => [category__in] => Array ( ) [category__not_in] => Array ( ) [category__and] => Array ( ) [post__in] => Array ( ) [post__not_in] => Array ( ) [post_name__in] => Array ( ) [tag__in] => Array ( ) [tag__not_in] => Array ( ) [tag__and] => Array ( ) [tag_slug__in] => Array ( ) [tag_slug__and] => Array ( ) [post_parent__in] => Array ( ) [post_parent__not_in] => Array ( ) [author__in] => Array ( ) [author__not_in] => Array ( ) [ignore_sticky_posts] => [suppress_filters] => [cache_results] => 1 [update_post_term_cache] => 1 [lazy_load_term_meta] => 1 [update_post_meta_cache] => 1 [post_type] => any [posts_per_page] => 9 [nopaging] => [comments_per_page] => 50 [no_found_rows] => [search_terms_count] => 1 [search_terms] => Array ( [0] => sophie ) [search_orderby_title] => Array ( [0] => gretacdma_posts.post_title LIKE '{889f9dde2793b886b91eb47378897f22eb2098e471145dec5d64e49020558861}sophie{889f9dde2793b886b91eb47378897f22eb2098e471145dec5d64e49020558861}' ) [order] => DESC [operator] => OR ) 
    

    On search.php, after displaying the formations, actualites are fetched this way:

    
          $pq         = new WP_Query('s='.$search_txt);// Posts Query                                        
          $pq->query_vars['post_type']        = 'post';                                                      
          $pq->query_vars['posts_per_page']   = 9999;                                                        
          $pq->query_vars['orderby']          = 'date';                                                      
          relevanssi_do_query($pq);
    

    If easier, I can give you access to the code repo with your email address.

Viewing 7 replies - 1 through 7 (of 7 total)