{"action":"created","issue":{"url":"https://api.github.com/repos/owen2345/camaleon-cms/issues/34","repository_url":"https://api.github.com/repos/owen2345/camaleon-cms","labels_url":"https://api.github.com/repos/owen2345/camaleon-cms/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/owen2345/camaleon-cms/issues/34/comments","events_url":"https://api.github.com/repos/owen2345/camaleon-cms/issues/34/events","html_url":"https://github.com/owen2345/camaleon-cms/issues/34","id":102027794,"number":34,"title":"Feature Request: Wordpress Import","user":{"login":"atbyrd","id":974295,"avatar_url":"https://avatars.githubusercontent.com/u/974295?v=3","gravatar_id":"","url":"https://api.github.com/users/atbyrd","html_url":"https://github.com/atbyrd","followers_url":"https://api.github.com/users/atbyrd/followers","following_url":"https://api.github.com/users/atbyrd/following{/other_user}","gists_url":"https://api.github.com/users/atbyrd/gists{/gist_id}","starred_url":"https://api.github.com/users/atbyrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atbyrd/subscriptions","organizations_url":"https://api.github.com/users/atbyrd/orgs","repos_url":"https://api.github.com/users/atbyrd/repos","events_url":"https://api.github.com/users/atbyrd/events{/privacy}","received_events_url":"https://api.github.com/users/atbyrd/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-20T00:13:27Z","updated_at":"2016-06-23T20:23:50Z","closed_at":"2015-08-29T15:56:56Z","body":"Is there any plan to make importing from wordpress automated?"},"comment":{"url":"https://api.github.com/repos/owen2345/camaleon-cms/issues/comments/228172258","html_url":"https://github.com/owen2345/camaleon-cms/issues/34#issuecomment-228172258","issue_url":"https://api.github.com/repos/owen2345/camaleon-cms/issues/34","id":228172258,"user":{"login":"coreyd303","id":6662565,"avatar_url":"https://avatars.githubusercontent.com/u/6662565?v=3","gravatar_id":"","url":"https://api.github.com/users/coreyd303","html_url":"https://github.com/coreyd303","followers_url":"https://api.github.com/users/coreyd303/followers","following_url":"https://api.github.com/users/coreyd303/following{/other_user}","gists_url":"https://api.github.com/users/coreyd303/gists{/gist_id}","starred_url":"https://api.github.com/users/coreyd303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreyd303/subscriptions","organizations_url":"https://api.github.com/users/coreyd303/orgs","repos_url":"https://api.github.com/users/coreyd303/repos","events_url":"https://api.github.com/users/coreyd303/events{/privacy}","received_events_url":"https://api.github.com/users/coreyd303/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T20:23:50Z","updated_at":"2016-06-23T20:23:50Z","body":"I am working on this same thing. I currently have:\r\n\r\n```\r\nnamespace :import do\r\ndesc 'Import Worpress XML Data'\r\n\r\n  task users: :environment do |_, _args|\r\n    File.open('lib/ck_import.xml') do |file|\r\n      users = Nokogiri::XML(file).xpath('//channel//wp:author')\r\n      users.each do |user|\r\n        user = CamaleonCms::User.create(\r\n          username: user.at_xpath('wp:author_login').text,\r\n          role: \"contributor\",\r\n          email: user.at_xpath('wp:author_email').text,\r\n          slug: user.at_xpath('wp:author_login').text,\r\n          password: \"ChangeMe!\",\r\n          site_id: -1,\r\n          is_valid_email: true,\r\n          first_name: user.at_xpath('wp:author_first_name').text,\r\n          last_name: user.at_xpath('wp:author_last_name').text\r\n        )\r\n        puts \"#{user[:username]} created.\"\r\n      end\r\n    end\r\n  end\r\n\r\n  task blog: :environment do |_, _args|\r\n    CamaleonCms::PostDefault.transaction do\r\n      CamaleonCms::PostDefault.destroy_all\r\n      File.open('lib/ck_import.xml') do |file|\r\n        items = Nokogiri::XML(file).xpath('//channel//item')\r\n        items.each do |item|\r\n          binding.pry\r\n          post = CamaleonCms::Post.create(\r\n              title: item.at_xpath('title').text.strip,\r\n              slug: item.at_xpath('wp:post_name').text,\r\n              content: item.at_xpath('content:encoded').text,\r\n              content_filtered: item.at_xpath('content:encoded').text.strip_tags,\r\n              status: item.at_xpath('wp:status').text,\r\n              published_at: item.at_xpath('pubDate').text.to_datetime,\r\n              post_parent: nil,\r\n              visibility: \"public\",\r\n              visibility_value: nil,\r\n              post_class: \"Post\",\r\n              created_at: item.at_xpath('wp:post_date').text.to_datetime,\r\n              updated_at: item.at_xpath('wp:post_date').text.to_datetime,\r\n              user_id: CamaleonCms::User.find_by_first_name(item.at_xpath('dc:creator').text.capitalize).id,\r\n              post_order: item.at_xpath('wp:menu_order').text.to_i,\r\n              taxonomy_id: 2,\r\n              is_feature: false)\r\n\r\n            cats = []\r\n              unless item.at_xpath('category').text.blank?\r\n                cats << CamaleonCms::Category.find_or_create_by(taxonomy: \"category\",\r\n                                                                parent_id: 2,\r\n                                                                name: item.at_xpath('category').text,\r\n                                                                term_group: 1,\r\n                                                                status: \"2\").id\r\n              end\r\n\r\n          cats.each do |c|\r\n            post.categories << c\r\n          end\r\n          post.save\r\n\r\n          puts \"#{post[:title]} : #{post[:published_at]}.\"\r\n        end\r\n      end\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nI am trying to figure out to connect meta data like\r\n`\t<wp:postmeta>\r\n\t\t\t<wp:meta_key>_thumbnail_id</wp:meta_key>\r\n\t\t\t<wp:meta_value><![CDATA[667]]></wp:meta_value>\r\n\t\t</wp:postmeta>\r\n\t\t<wp:postmeta>\r\n\t\t\t<wp:meta_key>_edit_last</wp:meta_key>\r\n\t\t\t<wp:meta_value><![CDATA[3]]></wp:meta_value>\r\n\t\t</wp:postmeta>`\r\n\r\nto a post. . . any ideas?"}}
{"actor":{"display_login":"coreyd303"}}