function fetch_feeds_for_id() { $post_id = $_POST["pid"]; $rssmi_global_options = get_option('rssmi_global_options'); $max = isset($rssmi_global_options['single_feed_max']) ? $rssmi_global_options['single_feed_max'] : 20; if (isset($post_id)) { wp_rss_multi_importer_post($post_id, $catID = NULL); rssmi_fetch_feed_items($post_id, $max); echo "Most recent feed items have been imported"; } die; }
function rssmi_activate_upgrade() { //this upgrades for 2.70 - only if upgrading //2.68 is beta version, so don't upgrade database for beta users $option_items = get_option('rss_import_items'); $wprssmi_admin_options = get_option('rss_admin_options'); //if (!empty($option_items) && floatval($old_version)<WP_RSS_MULTI_VERSION and floatval($old_version)<2.68){ if (!isset($wprssmi_admin_options['activate']) || $wprssmi_admin_options['activate'] == 0) { $post_options = get_option('rss_post_options'); $bloguserid = $post_options['bloguserid']; if (is_null($bloguserid)) { $bloguserid = 1; } $option_values = array_values($option_items); remove_action('save_post', 'rssmi_save_custom_fields'); remove_action('wp_insert_post', 'rssmi_fetch_feed_items'); for ($i = 0; $i <= count($option_items) - 1; $i++) { $feed_item = array('post_title' => $option_values[$i], 'post_content' => '', 'post_status' => 'publish', 'post_type' => 'rssmi_feed'); $inserted_ID = wp_insert_post($feed_item); $i = $i + 1; update_post_meta($inserted_ID, "rssmi_url", $option_values[$i]); $i = $i + 1; update_post_meta($inserted_ID, "rssmi_cat", $option_values[$i]); update_post_meta($inserted_ID, "rssmi_user", $bloguserid); rssmi_fetch_feed_items($inserted_ID); unset($feed_item); } add_action('save_post', 'rssmi_save_custom_fields'); add_action('wp_insert_post', 'rssmi_fetch_feed_items'); // delete_option('rss_import_items'); // set activate to 1 $wprssmi_admin_options['activate'] = 1; update_option('rss_admin_options', $wprssmi_admin_options); } }