Taxonomy Switch doesn't support Drupal v6.x
uranik - February 15, 2008 - 13:53
| Project: | Taxonomy Switch |
| Version: | HEAD |
| Component: | Code |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Description
taxonomy switch not support drupal v6.x :(

#1
It will almost certainly support D6 when D6 settles down and I start thinking about converting my own sites! Unless something better comes up in the meantime.
#2
Taxonomy Switch is very cool module, and very useful, waiting for the 6 version!
#3
I have a site that uses this module. It is one of the last modules (I use 37 modules) on my site to do an update. Most modules have a beta version by now.
Any time frame on this?
#4
At the moment I am so overloaded that I will probably start thinking about this around January 2009. Sorry it is so long - if you want to try doing it yourself I would be glad to test a patch though.
#5
subscribing
#6
subscribing
#7
Not sure if this helps but I gave the latest release for D5 a quick run through Deadwood, made a minor tweak or two and made a patch. It gives me an error on $vid_from after selecting the vocabularies but it's possible there's an issue on my development site too. Anyway, hope this helps.
#8
Okay, I couldn't leave it alone. Besides the changes Deadwood made in the previous patch, I also had to change calls like
module_invoke('taxonomy', 'get_vocabulary', ... );to
module_invoke('taxonomy', 'vocabulary_load', ...);Apparently the name of the taxonomy module hook changed in Drupal 6. I don't know if any other module_invoke() calls need to change, but I made the module work for my site with the changes in the attached patch. Again, this patch is against the current Drupal 5 release version of the .module file (the .info file just needs a minor change to say it works with Drupal 6).
I've also attached the .info and .module file for people who want to try it out but don't know how to apply a patch but want to help test. (Don't use these on any data you care about.)
Oh, and there are some TODO comments in there that Deadwood made. I left them in because I don't know the correct way to fix them yet.
#9
I've tested the patch and so far everything works fine.
#10
i tested with some taxonomies - no problems so far ...
#11
subscribing
#12
thanks, this patch worked
#13
Thanks very much for this - I will try it out and put up an official version as soon as possible
#14
can you pls explain how to test it? I have Drupal 6 site, and I need this module asap.
#15
-Download files from comment #8
-rename the two of them, removing .txt part from the end of the file (thus changing file extension to .module and .info)
-create new directory named "taxonomy_switch" at sites/all/modules and upload files there
-enable module in a usual way
-start using through new tab in admin -> taxonomy
#16
it works perfectly on my Drupal 6.9
Thanks.
#17
I don't get the "classify" tab on v6.9.
#18
I don't get it either....
#19
#20
subscribing
Greetings, -asb
#21
Does your user have "administer taxonomy" permission? If not you will not see the tab
#22
I don't get the tab even running as user 1. I verified that the admin users have "administer taxonomy" permission and still no "classify" tab.
#23
I don't get it on D6.12 either.
#24
I think D6 itself has settled down quite well. The major set of modules like CCK, Views have settled down too. On the other hand, many D5 modules are no longer being worked on.
#25
please help, i need to use taxonomy switch for 6.12 how can i do that, above comments are too tech-savvy. thanks
#26
@macrodesign: if you can't follow this discussion it is probably best that you do not attempt to use the "test" version for D6 in this thread. It is not even at the level of "beta" software at this stage and as such not safe to use unless you are sure of what you are doing and take necessary precautions (backups, etc.) Hopefully, the maintainer(s) of this module will see fit to move things along further soon and get a version out there that can be more widely tested and used.
#27
Thanks RK, i will wait for a D6 release than.
#28
Just used files available at #8 - all good so far (ie have been able to switch terms of VocabA to VocabB)
@macrodesign
If you are okay uploading a module, and you have a test site to try it on, all that is required AFAIK is to download the files from #8 - rename those files so they don't have .txt at end, ie
taxonomy_switch.info
taxonomy_switch.module
stick in a folder (for tidiness sake) upload folder to your site and enable (and give permissions if required) - worked for me
pretty much repeating what #15 said ;-)
#29
Thanks peted, i will surely give it a try
#30
For all those who want a true taxonomy switch in D6, can I suggest using Taxonomy Manager? See this post about Taxonomy Manager for details. I would be interested in feedback - if it works then I will deprecate taxonomy_switch.
#31
current stable version of Taxonomy Manager doesn't have such functionality yet. So it's way to early to deprecate Taxonomy Switch. We should at least wait for stable release. Then we should see if it'll be implemented for D5 Taxonomy Manager.
#32
I agree with mean0dspt.
#33
Could someone please explain what features are missing from Taxonomy_Manager to cover the needed features from Taxonomy_Switch? Thanks.
#34
@DamienMcKenna: well, the "classify" tab is actually pretty cool. Possibly it could be made into a separate module, because it doesn't really fit in Taxonomy Manager...
The other main feature is now in taxonomy manager: #269341: Move term into other vocabulary.
#35
Hi,
actually the "classify" tab is a lifesaver for me on several D5 sites where - for whatever reason - the taxonomy fields disappeared from the node editing forms. I would really, really miss it - not only on those D5 sites.
Maybe Taxonomy manager could bundle the "classify" tab as an optional sub-module (if there's code that can be shared)?
Greetings, -asb
#36
I agree with asb. The classify tab is incredibly valuable.
#37
ok try this I thnik is working. Do mot forget to clear the cahe.
<?php
/* $Id: taxonomy_switch.module,v 1.7 2007/09/01 11:38:51 joelguesclin Exp $ */
/**
* @file taxonomy_switch.module
* This module allows you to move a term from one vocabulary to another, or to
* reclassify a node
*/
/**
* Implementation of hook_menu: Define menu links.
*
* @note See hook_menu for a description of parameters and return values.
*/
function taxonomy_switch_menu() {
$items['node/%node/classify'] = array(
'title' => t('Classify'),
'type' => MENU_LOCAL_TASK,
'access callback' => "taxonomy_switch_check_local_tasks",
'access arguments' => array(1),
'page callback' => 'taxonomy_switch_node',
'page arguments' => array(1),
);
return $items;
}
function taxonomy_switch_check_local_tasks($node) {
// we introduce a new accses rule
return (user_access('taxonomy_switch_view'));
}
function taxonomy_switch_node() {
global $user;
$op = $_POST['op'];
$edit = $_POST;
// arg(1) is the nid
if ($op) {
$node = module_invoke('node', 'load', arg(1));
taxonomy_node_save($node, $edit['taxonomy']);
if (module_exists('checkout')) {
module_invoke('checkout', 'checkin', arg(1));
}
watchdog('content', '%type: reclassified %title.', array('%type' => $node->type, '%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
drupal_set_message(t('The document has been reclassified'));
print theme('page', $output);
return;
}
if (module_exists('checkout')) {
$checkout_info = module_invoke('checkout', 'checkout', arg(1));
if ($checkout_info->uid == $user->uid) {
$checked_out = FALSE;
}
else {
$checked_out = TRUE;
}
}
else {
$checked_out = FALSE;
}
if (!$checked_out) {
$output = drupal_get_form('taxonomy_switch_classify_form');
return $output;
}
else {
module_invoke('checkout', 'message', $checkout_info);
}
}
/* In Drupal 5, forms must be created in dedicated builder functions */
function taxonomy_switch_classify_form($form_values = NULL) {
$form = array();
$form['taxonomy']['#tree'] = TRUE;
$node = module_invoke('node', 'load', arg(1));
drupal_set_title(check_plain($node->title));
$node_vocabs = module_invoke('taxonomy', 'get_vocabularies', $node->type);
foreach ($node_vocabs as $i => $vid) {
$form['taxonomy'][$vid->vid] = module_invoke('taxonomy', 'form', $vid->vid);
$node_terms = taxonomy_node_get_terms_by_vocabulary($node, $vid->vid);
if ($vid->tags == 1) {
$typed_string = array();
foreach($node_terms as $ix => $n_tid) {
$typed_string[] .= $n_tid->name;
}
$form['taxonomy']['tags'][$vid->vid]['#title'] = $form['taxonomy'][$vid->vid]['#title'];
$form['taxonomy']['tags'][$vid->vid]['#description'] = $form['taxonomy'][$vid->vid]['#description'];
$form['taxonomy']['tags'][$vid->vid]['#default_value'] = implode(', ', $typed_string);
$form['taxonomy']['tags'][$vid->vid]['#type'] = 'textfield';
$form['taxonomy']['tags'][$vid->vid]['#maxlength'] = 120;
$form['taxonomy']['tags'][$vid->vid]['#size'] = 60;
$form['taxonomy']['tags'][$vid->vid]['#autocomplete_path'] = 'taxonomy/autocomplete/'. $vid->vid;
unset($form['taxonomy'][$vid->vid]);
}
else {
$form['taxonomy'][$vid->vid]['#default_value'] = array_keys($node_terms);
}
if ($vid->required) {
$form['taxonomy'][$vid->vid]['#required'] = TRUE;
}
}
$form[] = array(
'#type' => 'submit',
'#value' => t("Classify"),
);
// $form['#redirect'] = FALSE;
return $form;
}
?>
#38
Is the content in #37 intended as a full replacement for the module code in #8 or as a patch to it?
#39
Depends on your wish you van use it as a standalone module, or as a patch. It works in both ways.
Cheers
#40
I will try to find some time to test this. If it works ok for me then I will make it a standalone module to replace the present one, since the rest is handled by the Taxonomy Manager module
#41
Hi in case you are goiing to try it please use the code bellow. I forgot to include the function which declares the permission :)
<?php
/* $Id: taxonomy_switch.module,v 1.7 2007/09/01 11:38:51 joelguesclin Exp $ */
/**
* @file taxonomy_switch.module
* This module allows you to move a term from one vocabulary to another, or to
* reclassify a node
*/
/**
* Implementation of hook_menu: Define menu links.
*
* @note See hook_menu for a description of parameters and return values.
*/
function taxonomy_switch_menu() {
$items['node/%node/classify'] = array(
'title' => t('Classify'),
'type' => MENU_LOCAL_TASK,
'access callback' => "taxonomy_switch_check_local_tasks",
'access arguments' => array(1),
'page callback' => 'taxonomy_switch_node',
'page arguments' => array(1),
);
return $items;
}
function taxonomy_switch_perm() {
return array(
'taxonomy_switch_view'
);
}
function taxonomy_switch_check_local_tasks($node) {
// we introduce a new accses rule
return (user_access('taxonomy_switch_view'));
}
function taxonomy_switch_node() {
global $user;
$op = $_POST['op'];
$edit = $_POST;
// arg(1) is the nid
if ($op) {
$node = module_invoke('node', 'load', arg(1));
taxonomy_node_save($node, $edit['taxonomy']);
if (module_exists('checkout')) {
module_invoke('checkout', 'checkin', arg(1));
}
watchdog('content', '%type: reclassified %title.', array('%type' => $node->type, '%title' => $node->title), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
drupal_set_message(t('The document has been reclassified'));
print theme('page', $output);
return;
}
if (module_exists('checkout')) {
$checkout_info = module_invoke('checkout', 'checkout', arg(1));
if ($checkout_info->uid == $user->uid) {
$checked_out = FALSE;
}
else {
$checked_out = TRUE;
}
}
else {
$checked_out = FALSE;
}
if (!$checked_out) {
$output = drupal_get_form('taxonomy_switch_classify_form');
return $output;
}
else {
module_invoke('checkout', 'message', $checkout_info);
}
}
/* In Drupal 5, forms must be created in dedicated builder functions */
function taxonomy_switch_classify_form($form_values = NULL) {
$form = array();
$form['taxonomy']['#tree'] = TRUE;
$node = module_invoke('node', 'load', arg(1));
drupal_set_title(check_plain($node->title));
$node_vocabs = module_invoke('taxonomy', 'get_vocabularies', $node->type);
foreach ($node_vocabs as $i => $vid) {
$form['taxonomy'][$vid->vid] = module_invoke('taxonomy', 'form', $vid->vid);
$node_terms = taxonomy_node_get_terms_by_vocabulary($node, $vid->vid);
if ($vid->tags == 1) {
$typed_string = array();
foreach($node_terms as $ix => $n_tid) {
$typed_string[] .= $n_tid->name;
}
$form['taxonomy']['tags'][$vid->vid]['#title'] = $form['taxonomy'][$vid->vid]['#title'];
$form['taxonomy']['tags'][$vid->vid]['#description'] = $form['taxonomy'][$vid->vid]['#description'];
$form['taxonomy']['tags'][$vid->vid]['#default_value'] = implode(', ', $typed_string);
$form['taxonomy']['tags'][$vid->vid]['#type'] = 'textfield';
$form['taxonomy']['tags'][$vid->vid]['#maxlength'] = 120;
$form['taxonomy']['tags'][$vid->vid]['#size'] = 60;
$form['taxonomy']['tags'][$vid->vid]['#autocomplete_path'] = 'taxonomy/autocomplete/'. $vid->vid;
unset($form['taxonomy'][$vid->vid]);
}
else {
$form['taxonomy'][$vid->vid]['#default_value'] = array_keys($node_terms);
}
if ($vid->required) {
$form['taxonomy'][$vid->vid]['#required'] = TRUE;
}
}
$form[] = array(
'#type' => 'submit',
'#value' => t("Classify"),
);
// $form['#redirect'] = FALSE;
return $form;
}
?>