I use drupal 7. I created a content type with these fields:
- one field to upload a file to private folder
- a taxonomy field (for that file)
my problem: i can save one file with one taxonomy! but how should i get these data again!(is there any API here) I want to know which taxonomy was saved for a certain file(i need to check it inside my custom module). i raised similar question here: so by following code i can get corresponding field:
$nids = db_query("SELECT nid FROM node WHERE title LIKE :title", array(':title' => '%'.$title.'%'))->fetchCol();
$nodes = node_load_multiple($nids);
foreach($nodes as $node) {
// using field_get_items here automatically loads the field in the correct language
$field_items = field_get_items('node', $node, 'field_subtitle');
$subtitle = $field_items[0]['safe_value'];
}
but it seems it dose not work taxonomy attached field.
why do i have this question: i sell some digital files and now i am developing a module for selling my files. i want to sell them this way: each file has a certain taxonomy. when my user buys that file he or she gets that taxonomy(and i will keep it in one table). once he clicks on download link i have to check whether that user has that taxonomy already or not! if he has i will let him to download it.