Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#6882 closed defect (bug) (duplicate)

WordPress Simple Tagging Import Problem

Reported by: na3s's profile na3s Owned by:
Milestone: Priority: high
Severity: critical Version: 2.5.1
Component: General Keywords: simple tagging import tags
Focuses: Cc:

Description

Simple Tagging Import is NON-FUNCTIONAL. When attempting to import tags the following occurs:

1) Step 1 -> Runs smoothly, counts the rows in WPPREFIX_stp_tags table, presents the user with number and 'Step 2' button.
2) Step 2 -> Appears to run, for 1-2 minutes, and then the loading stops and it displays "Adding Tags to Posts…" it does not go ANYWHERE after this, and is broken halfway through the import.

When examining this further, I have concluded that it successfuly adds the tags from the WPPREFIX_stp_tags table to the wp_terms table, but fails to add the tags to the posts; hence failing to create the relationships between a post and it's tag(s).

This bug prevents any user relying on Simple Tagging in previous versions to upgrade to 2.5.x. It makes the upgrade task impossible.

I tested this bug in 3 browsers (Safari, IE, firefox), the bug remains consistent.

When working on this bug it will be important to keep in mind that many users will have already gotten halfway through the (broken) Simple Tagging import process. Therefor, the script will need to recognize a broken transaction (tags already imported, but no relationships made)

Change History (4)

#1 @na3s
16 years ago

I cannot locate the source of this issue. Within the function 'tag2post' the function 'wp_add_post_tags returns' false. The parameters being fed into this function are $the_post and $the_tag, both of which seem to have no errors, and the correct types (an integer and a string). I have a feeling it may be an error somewhere in the file wp-includes/post.php, but have no way of verifying this. Below is an alternate tag2post function I used while attempting to debug this issue; it may be of use to someone.

function tag2post ( ) {
	global $wpdb;

	// get the tags and posts we imported in the last 2 steps
	$posts = get_option('stpimp_posts');

	// null out our results
	$tags_added = 0;
	//make a pretty scrollable boxy
	echo '<div style="height:300px;width:auto;overflow:scroll;">';
	// loop through each post and add its tags to the db
	foreach ( $posts as $this_post ) {
		$the_post = (int) $this_post->post_id;
		//$the_post = $this_post->post_id;
		$the_tag = $wpdb->escape($this_post->tag_name);
		//echo some data about each row.
		$wtfoutput = $tags_added."->|".$the_post."|<em>(".gettype($the_post).")</em> |".$the_tag."|<em>(".gettype($the_tag).")</em>";
		// try to add the tag to a broken function and output a friendly status message.
		if(wp_set_post_tags($the_post, $the_tag, true)) {
			$wtfoutput .= ' <strong style="color:#00ff00;">Success!</strong><br />'."\r\n";
		} else {
			$wtfoutput .= ' <strong style="color:#ff0000;">Shitty.</strong><br />'."\r\n";
		}
		echo $wtfoutput;
		$tags_added++;
	}
	echo "</div>";

	// that's it, all posts should be linked to their tags properly, pending any errors we just spit out!
	//it never gets this far, it just hangs and the foreach breaks!
	return $tags_added;
}


#2 @na3s
16 years ago

Note, in that function above, you should change it to wp_add_post_tags, I switched it to see if it made a difference, which it didn't (and logically I knew wouldn't)

#3 @na3s
16 years ago

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

oops, a dup! (sry)

#4 @thee17
16 years ago

  • Milestone 2.5.2 deleted
Note: See TracTickets for help on using tickets.