New book never becomes enabled automatically if any ABB use taxonomy terms as condition
Azol - September 23, 2009 - 15:05
| Project: | Advanced Book Blocks |
| Version: | 6.x-1.9 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Azol |
| Status: | needs review |
Description
You can create new book, but it will not be automatically enabled for specific block even if it has specific taxonomy term associated with it. You can go into ABB block setting and do Mass Enable and the book will be enabled for that block. It is only taxonomy automation that does not work. (I use Drupall 6.14)
I suspect that the problem lies in this part of code -
$result = db_query("SELECT vid FROM {vocabulary} WHERE name <> 'FORUMS'");
while ($vocab = db_fetch_object($result)) {
if (is_array($node->taxonomy[$vocab->vid])) {
if (array_intersect($node->taxonomy[$vocab->vid], $tid_trig_array) != NULL) {
$check[] = array_intersect($node->taxonomy[$vocab->vid], $tid_trig_array);
}
}
}Someone with deeper Drupal understanding might figure out what is the problem here.
I think we should use something along the lines with
$result = db_query("SELECT tid FROM {term_node} WHERE nid = %d", $bid);
while ($term = db_fetch_object($result)) {
$node_terms[] = $term->tid;
if (array_intersect($node_terms,$tid_trig_array) != NULL) {
$check[] = array_intersect($node_terms,$tid_trig_array);
}
}as it does in Mass Enable feature in ABB module.

#1
I am not yet familiar with patching system, so I just went through all the code and I changed many things that were causing bugs with:
1) New books never appearing in AB blocks with Taxonomy Automation options set;
2) Books re-appearing in different AB blocks after editing or deleting top-level books;
I attached the whole advancedbookblocks.module file here. Please test it in your ABB 6.x-1.9 installations (just replace original file) and let me know if it solves your problems the way it solved mine.