0) : $userdata = array(); $userdata['ID'] = NULL; $userdata['user_login'] = sanitize_user($newuser_name); $userdata['user_login'] = apply_filters('pre_user_login', $userdata['user_login']); $userdata['user_nicename'] = sanitize_title($newuser_name); $userdata['user_nicename'] = apply_filters('pre_user_nicename', $userdata['user_nicename']); $userdata['display_name'] = $wpdb->escape($newuser_name); $newuser_id = wp_insert_user($userdata); if (is_numeric($newuser_id)) : $fix_mismatch_to_id = $newuser_id; else : // TODO: Add some error detection and reporting endif; else : // TODO: Add some error reporting endif; else : $fix_mismatch_to_id = $GLOBALS['fwp_post']['fix_mismatch_to']; endif; $fix_mismatch_from_id = (int) $GLOBALS['fwp_post']['fix_mismatch_from']; if (is_numeric($fix_mismatch_from_id)) : // Make a list of all the items by this author syndicated from this feed... $post_ids = $wpdb->get_col(" SELECT {$wpdb->posts}.id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE ({$wpdb->posts}.id = {$wpdb->postmeta}.post_id) AND {$wpdb->postmeta}.meta_key = 'syndication_feed_id' AND {$wpdb->postmeta}.meta_value = '{$link_id}' AND {$wpdb->posts}.post_author = '{$fix_mismatch_from_id}' "); if (count($post_ids) > 0) : // Re-assign them all to the correct author if (is_numeric($fix_mismatch_to_id)) : // re-assign to a particular user $post_set = "(".implode(",", $post_ids).")"; // Getting the revisions too, if there are any if (fwp_test_wp_version(FWP_SCHEMA_26)) : $parent_in_clause = "OR {$wpdb->posts}.post_parent IN $post_set"; else : $parent_in_clause = ''; endif; $wpdb->query(" UPDATE {$wpdb->posts} SET post_author='{$fix_mismatch_to_id}' WHERE ({$wpdb->posts}.id IN $post_set $parent_in_clause) "); $mesg = "Re-assigned ".count($post_ids)." post".((count($post_ids)==1)?'':'s')."."; // ... and kill them all elseif ($fix_mismatch_to_id=='filter') : foreach ($post_ids as $post_id) : wp_delete_post($post_id); endforeach; $mesg = "Deleted ".count($post_ids)." post".((count($post_ids)==1)?'':'s')."."; endif; else : $mesg = "Couldn't find any posts that matched your criteria."; endif; endif; elseif (isset($GLOBALS['fwp_post']['save'])) : if (is_object($link) and $link->found()) : $alter = array (); // Unfamiliar author rule if (isset($GLOBALS['fwp_post']["unfamiliar_author"])) : if ('site-default'==$GLOBALS['fwp_post']["unfamiliar_author"]) : unset($link->settings["unfamiliar author"]); elseif ('newuser'==$GLOBALS['fwp_post']["unfamiliar_author"]) : $newuser_name = trim($GLOBALS['fwp_post']["unfamiliar_author_newuser"]); $link->map_name_to_new_user(/*name=*/ NULL, $newuser_name); else : $link->settings["unfamiliar author"] = $GLOBALS['fwp_post']["unfamiliar_author"]; endif; endif; // Handle author mapping rules if (isset($GLOBALS['fwp_post']['author_rules_name']) and isset($GLOBALS['fwp_post']['author_rules_action'])) : unset($link->settings['map authors']); foreach ($GLOBALS['fwp_post']['author_rules_name'] as $key => $name) : // Normalize for case and whitespace $name = strtolower(trim($name)); $author_action = strtolower(trim($GLOBALS['fwp_post']['author_rules_action'][$key])); if (strlen($name) > 0) : if ('newuser' == $author_action) : $newuser_name = trim($GLOBALS['fwp_post']['author_rules_newuser'][$key]); $link->map_name_to_new_user($name, $newuser_name); else : $link->settings['map authors']['name'][$name] = $author_action; endif; endif; endforeach; endif; if (isset($GLOBALS['fwp_post']['add_author_rule_name']) and isset($GLOBALS['fwp_post']['add_author_rule_action'])) : $name = strtolower(trim($GLOBALS['fwp_post']['add_author_rule_name'])); $author_action = strtolower(trim($GLOBALS['fwp_post']['add_author_rule_action'])); if (strlen($name) > 0) : if ('newuser' == $author_action) : $newuser_name = trim($GLOBALS['fwp_post']['add_author_rule_newuser']); $link->map_name_to_new_user($name, $newuser_name); else : $link->settings['map authors']['name'][$name] = $author_action; endif; endif; endif; $alter[] = "link_notes = '".$wpdb->escape($link->settings_to_notes())."'"; $alter_set = implode(", ", $alter); // issue update query $result = $wpdb->query(" UPDATE $wpdb->links SET $alter_set WHERE link_id='$link_id' "); $updated_link = true; // reload link information from DB if (function_exists('clean_bookmark_cache')) : clean_bookmark_cache($link_id); endif; $link =& new SyndicatedLink($link_id); else : if ('newuser'==$GLOBALS['fwp_post']['unfamiliar_author']) : $newuser_name = trim($GLOBALS['fwp_post']['unfamiliar_author_newuser']); if (strlen($newuser_name) > 0) : $userdata = array(); $userdata['ID'] = NULL; $userdata['user_login'] = sanitize_user($newuser_name); $userdata['user_login'] = apply_filters('pre_user_login', $userdata['user_login']); $userdata['user_nicename'] = sanitize_title($newuser_name); $userdata['user_nicename'] = apply_filters('pre_user_nicename', $userdata['user_nicename']); $userdata['display_name'] = $wpdb->escape($newuser_name); $newuser_id = wp_insert_user($userdata); if (is_numeric($newuser_id)) : update_option('feedwordpress_unfamiliar_author', $newuser_id); else : // TODO: Add some error detection and reporting endif; else : // TODO: Add some error reporting endif; else : update_option('feedwordpress_unfamiliar_author', $GLOBALS['fwp_post']['unfamiliar_author']); endif; if (isset($GLOBALS['fwp_post']['match_author_by_email']) and $GLOBALS['fwp_post']['match_author_by_email']=='yes') : update_option('feedwordpress_do_not_match_author_by_email', 'no'); else : update_option('feedwordpress_do_not_match_author_by_email', 'yes'); endif; if (isset($GLOBALS['fwp_post']['null_emails'])) : update_option('feedwordpress_null_email_set', $GLOBALS['fwp_post']['null_emails']); endif; $updated_link = true; endif; else : $updated_link = false; endif; $unfamiliar = array ('create' => '','default' => '','filter' => ''); if (is_object($link) and $link->found()) : if (is_string($link->settings["unfamiliar author"])) : $key = $link->settings["unfamiliar author"]; else: $key = 'site-default'; endif; else : $key = FeedWordPress::on_unfamiliar('author'); endif; $unfamiliar[$key] = ' selected="selected"'; $match_author_by_email = !('yes' == get_option("feedwordpress_do_not_match_author_by_email")); $null_emails = FeedWordPress::null_email_set(); ?>

Syndicated author settings updated.

Syndicated Author Settingsfound()) : ?>: link->link_name, 1); ?>

found()) : ?>

These settings only affect posts syndicated from link->link_name, 1); ?>.

These settings affect posts syndicated from any feed unless they are overridden by settings for that specific feed.

found()) : ?> found())) : ?>
New authors Authors who haven't been syndicated before named

Syndicated authors For attributing posts by specific authors. Blank out a name to delete the rule. Fill in a new name at the bottom to create a new rule.

settings['map authors'])) : ?> settings['map authors'] as $author_rules) : foreach ($author_rules as $author_name => $author_action) : $i++; ?>
Posts by named
Posts by named
Matching Authors
  • Unless the e-mail address is one of the following anonymous e-mail addresses:

Fixing mis-matched authors:

Take all the posts from this feed attributed to and instead named