Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#4107 closed task (blessed) (fixed)

Tags to categories importer

Reported by: rob1n's profile rob1n Owned by: rob1n's profile rob1n
Milestone: 2.2 Priority: high
Severity: critical Version:
Component: Administration Keywords:
Focuses: 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 (2)

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

Download all attachments as: .zip

Change History (20)

#1 @ryan
18 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.

#2 @rob1n
18 years ago

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.

@rob1n
18 years ago

v3

@rob1n
18 years ago

v3

#3 @rob1n
18 years ago

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

#4 @ryan
18 years ago

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

#5 @rob1n
18 years ago

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

#6 @rob1n
18 years ago

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

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

#7 @rob1n
18 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

To do -- link to converter.

#8 @rob1n
18 years ago

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

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

#9 @glitch010101
18 years ago

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

#10 @Viper007Bond
18 years ago

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

#11 @foolswisdom
18 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#12 @rob1n
18 years ago

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

#13 @rob1n
18 years ago

Yep. Took that out and worked for me.

#14 @rob1n
18 years ago

  • Severity changed from major to critical

#15 @rob1n
18 years ago

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

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

#16 follow-up: @matt
18 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

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.

#17 in reply to: ↑ 16 @rob1n
18 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 :\.

#18 @rob1n
18 years ago

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

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

Note: See TracTickets for help on using tickets.