have a web page that options just a few views based mostly on content material varieties. Every content material sort features a key phrase subject. This web page is reached from a brief quiz. I am attempting to restrict Drupal Development content material in Drupal Development views based mostly on responses in Drupal Development quiz by pulling Drupal Development $_POST knowledge and evaluating it to Drupal Development key phrase subject. Drupal Developer code is executing, and I am pretty positive I’ve Drupal Development be a part of proper, however as an alternative of limiting Drupal Development content material to matching key phrases, Drupal Development total show block simply disappears.
Right here is my module code:
<?php if (!empty($_POST["q1"])) { $q1 = $_POST['q1']; $q3 = $_POST['q3']; /** * Implements hook_views_query_alter so as to add a the place clause to Drupal Development views queries */ perform iamru_keyword_filter_views_query_alter(&$view, &$question) { world $q1, $q3; if ($view->title == 'iamru_prepared_statement') { $query->add_table('field_data_field_keyword'); $query->add_where(1,'field_data_field_keyword.field_keyword_value', $q1, '=' ); } if ($view->title == 'iamru_word_for_you_view') { $query->add_table('field_data_field_keyword'); $query->add_where(1,'field_data_field_keyword.field_keyword_value', $q3, '=' ); } } }
Can anybody see the place I’ve gone flawed right here?
Fascinating replace: If I substitute $q1 with ‘somekeyword’ in Drupal Development add_where name, it really works.