Commit be0b774c authored by Steven Wittens's avatar Steven Wittens
Browse files

- #57523: Make taxonomy delete vocabulary consistent with other taxonomy hook ops

parent ec04325b
......@@ -149,10 +149,10 @@ function forum_nodeapi(&$node, $op, $teaser, $page) {
* Implementation of hook_taxonomy().
*/
function forum_taxonomy($op, $type, $term = NULL) {
if ($op == 'delete' && $term->vid == _forum_get_vid()) {
if ($op == 'delete' && $term['vid'] == _forum_get_vid()) {
switch ($type) {
case 'term':
$results = db_query('SELECT f.nid FROM {forum} f WHERE f.tid = %d', $term->tid);
$results = db_query('SELECT f.nid FROM {forum} f WHERE f.tid = %d', $term['tid']);
while ($node = db_fetch_object($results)) {
// node_delete will also remove any association with non-forum vocabularies.
node_delete($node->nid);
......@@ -160,7 +160,7 @@ function forum_taxonomy($op, $type, $term = NULL) {
// For containers, remove the tid from the forum_containers variable.
$containers = variable_get('forum_containers', array());
if ($key = array_search($term->tid, $containers)) {
if ($key = array_search($term['tid'], $containers)) {
unset($containers[$key]);
}
variable_set('forum_containers', $containers);
......
......@@ -149,10 +149,10 @@ function forum_nodeapi(&$node, $op, $teaser, $page) {
* Implementation of hook_taxonomy().
*/
function forum_taxonomy($op, $type, $term = NULL) {
if ($op == 'delete' && $term->vid == _forum_get_vid()) {
if ($op == 'delete' && $term['vid'] == _forum_get_vid()) {
switch ($type) {
case 'term':
$results = db_query('SELECT f.nid FROM {forum} f WHERE f.tid = %d', $term->tid);
$results = db_query('SELECT f.nid FROM {forum} f WHERE f.tid = %d', $term['tid']);
while ($node = db_fetch_object($results)) {
// node_delete will also remove any association with non-forum vocabularies.
node_delete($node->nid);
......@@ -160,7 +160,7 @@ function forum_taxonomy($op, $type, $term = NULL) {
// For containers, remove the tid from the forum_containers variable.
$containers = variable_get('forum_containers', array());
if ($key = array_search($term->tid, $containers)) {
if ($key = array_search($term['tid'], $containers)) {
unset($containers[$key]);
}
variable_set('forum_containers', $containers);
......
......@@ -121,7 +121,7 @@ function taxonomy_menu($may_cache) {
* List and manage vocabularies.
*/
function taxonomy_overview_vocabularies() {
$vocabularies = taxonomy_get_vocabularies();
$vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vocabulary) {
$types = array();
foreach ($vocabulary->nodes as $type) {
......@@ -133,7 +133,7 @@ function taxonomy_overview_vocabularies() {
$form[$vocabulary->vid]['edit'] = array('#value' => l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"));
$form[$vocabulary->vid]['list'] = array('#value' => l(t('list terms'), "admin/taxonomy/$vocabulary->vid"));
}
return drupal_get_form('taxonomy_overview_vocabularies', $form);
}
......@@ -156,7 +156,7 @@ function theme_taxonomy_overview_vocabularies($form) {
$rows[] = array(array('data' => t('No categories available.'), 'colspan' => '4', 'class' => 'message'));
}
$header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '2'));
$output = theme('table', $header, $rows, array('id' => 'taxonomy'));
$output .= form_render($form);
return $output;
......@@ -509,7 +509,7 @@ function taxonomy_del_term($tid) {
}
}
$term = taxonomy_get_term($tid);
$term = (array) taxonomy_get_term($tid);
db_query('DELETE FROM {term_data} WHERE tid = %d', $tid);
db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid);
......
......@@ -121,7 +121,7 @@ function taxonomy_menu($may_cache) {
* List and manage vocabularies.
*/
function taxonomy_overview_vocabularies() {
$vocabularies = taxonomy_get_vocabularies();
$vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vocabulary) {
$types = array();
foreach ($vocabulary->nodes as $type) {
......@@ -133,7 +133,7 @@ function taxonomy_overview_vocabularies() {
$form[$vocabulary->vid]['edit'] = array('#value' => l(t('edit vocabulary'), "admin/taxonomy/edit/vocabulary/$vocabulary->vid"));
$form[$vocabulary->vid]['list'] = array('#value' => l(t('list terms'), "admin/taxonomy/$vocabulary->vid"));
}
return drupal_get_form('taxonomy_overview_vocabularies', $form);
}
......@@ -156,7 +156,7 @@ function theme_taxonomy_overview_vocabularies($form) {
$rows[] = array(array('data' => t('No categories available.'), 'colspan' => '4', 'class' => 'message'));
}
$header = array(t('Name'), t('Type'), array('data' => t('Operations'), 'colspan' => '2'));
$output = theme('table', $header, $rows, array('id' => 'taxonomy'));
$output .= form_render($form);
return $output;
......@@ -509,7 +509,7 @@ function taxonomy_del_term($tid) {
}
}
$term = taxonomy_get_term($tid);
$term = (array) taxonomy_get_term($tid);
db_query('DELETE FROM {term_data} WHERE tid = %d', $tid);
db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment