Ticket #4107 (closed task (blessed): fixed)

Opened 5 years ago

Last modified 5 years ago

Tags to categories importer

Reported by: rob1n Owned by: rob1n
Priority: high Milestone: 2.2
Component: Administration Version:
Severity: critical Keywords:
Cc:

Description

Basically, a category to tag importer that *selectively* converts categories. This is because, for example, if you have a Politics category, but have a one-time (maybe two-time) category for Iraq War, the Iraq War is more tag material, whereas the Politics category should stay that way.

So the solution that was reached in #wordpress-dev was to have the user presented with a checklist of categories, and they can choose which categories to import and which not to.

I'm planning to have it done by this weekend (weekend of 4/6).

Attachments

wp-cat2tag.2.php Download (4.0 KB) - added by rob1n 5 years ago.
v3
wp-cat2tag.php Download (4.0 KB) - added by rob1n 5 years ago.
v3

Change History

comment:1   ryan5 years ago

Misc thoughts. Convert category to tag by setting the type bitfield to TAXONOMY_TAG unless the category is also a link category (link_count > 0). In that case, bitwise or TAXONOMY_TAG into the bitfield. Change rel_type in post2cat from category to tag for all posts with that category id. Copy count to tag_count and then zero out count. Link to the importer from Manage->Categories for better discoverability.

Okay, that's about 80% done. Just the bitwise stuff and count adjustments that need to be made. If you could post some examples of the bitwise stuff, that'd be great. I'm completely ignorant of bitwise functions :\.

I'll tackle the rest tomorrow morning, PST.

rob1n5 years ago

v3

rob1n5 years ago

v3

(In [5201]) Add initial category to tag importing. see #4107

comment:4   ryan5 years ago

Todo: Add call to clean_category_cache(). Link to converter from Manage->Categories.

(In [5203]) Add clean_category_cache() and capability checking. see #4107

  • Status changed from new to closed
  • Resolution set to fixed

I think the initial work is pretty much done. We can open other tickets in reference to this one, or just reopen this.

  • Status changed from closed to reopened
  • Resolution fixed deleted

To do -- link to converter.

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [5216]) Link to categories to tags converter and UTW importer. fixes #4100 #4107

I get the "cheatin' uh?" error when I go to use this. Doing a little googling, it seems I may have some permission issues causing that error but everything looks okay.

3 1 gNYC_capabilities a:1:{s:13:"administrator";b:1;} I'm also using a custom table prefix (gNYC_ instead of wp_), and I put my wp_cat2tags.php file in wp-admin

I'm running the nightly 2.2-bleeding from 4/9/2007

P.S. - This is my first bug here, so please let me know if I can provide more info or if this is the wrong place for this issue.

Thanks Eric Skiff

Confirmed issue and I'm not using any custom permissions plugin.

  • Status changed from closed to reopened
  • Resolution fixed deleted

This may be because I checked for current_user_can('manage_tags') -- not sure if that's set up.

Yep. Took that out and worked for me.

  • Severity changed from major to critical
  • Status changed from reopened to closed
  • Resolution set to fixed

(In [5218]) Just check for manage_categories. fixes #4107

comment:16 follow-up: ↓ 17   matt5 years ago

  • Status changed from closed to reopened
  • Resolution fixed deleted

Every time I run this it gives me this error, for every category:

Converting category #79... Category doesn't exist!

It also seems to list tags in the checkbox thing, where it should really only lists categories.

comment:17 in reply to: ↑ 16   rob1n5 years ago

Replying to matt:

Every time I run this it gives me this error, for every category:

Converting category #79... Category doesn't exist!

I *think* this is because apparently category_exists return the category ID on success, and also it takes the nicename. I'll add in a function local to the importer class that checks based on ID, and returns either boolean true or false.

It also seems to list tags in the checkbox thing, where it should really only lists categories.

This is just my stupid mistake :\.

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [5229]) Use own category_exists() function, and only list categories to convert. fixes #4107

Note: See TracTickets for help on using tickets.