The users in my webapplication have a term reference
suppliers.
I also have a content type
transaction where I have the same term reference
. Now I would like to hide the select list and set the default value programmatically. This is what I do now:
$form['field_supplier']['#type'] = 'hidden';
$user_suppliers = array();
foreach($user_selling->field_suppliers['und'] as $supplier)
{
$user_suppliers[] = $supplier['tid'];
}
$firstsupplier = reset($user_suppliers);
$first_supplier = taxonomy_term_load($firstsupplier);
As you can see I loop through the tid's and save them in array. Afterwards I pick the first one (there's a reason I don't pick the first instead of looping through).
The $firstsupplier
variable results 7 so what's not abnormal for a tid. But when I want to load the taxonomy term I get a response false... (he can't find it) .
I recently resetted my taxonomy vocabulary
to alphabetical, could that be the reason? (I think not, because I tried it after saving them in a random order)