drupal7

Add a NOT IN condition and a nested query to your views WHERE condition

PROBLEM: 

I needed to add a NOT IN condition with a nested query for the WHERE condition. The usual method wont work

 

$view->query->where[1]['conditions'][] = array(
            ['field'] => 'groups_group_membership.type'
            ['value'] => array
                (
                    [0] => 'SELECT_QUERY_HERE'
                  
                )

            ['operator'] => IN
        );

SOLUTION :

The way that works

 

Programatically adding taxonomy terms as a Hierachy

Submitted by nmeegama on Fri, 09/05/2014 - 21:00

Problem

We can programatically add taxonomies, thats easy but adding it as a child term is the hard part

Solution

We need to fist create a validation function dedicated for the term reference filed 

$form[TAG_FIELD_NAME]['#element_validate'][] = 'taxonomy_field_tags_validate';