On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • So ive tried various import sizes when importing wordpress posts in Articles but when I import the file (via upload or on server) it just stays "Saving.." Please wait.....forever. If I check in another tab, nothing is imported. No errors. No nothing.


    Suggestions?
    • I had the same problem, and investigating the code, in the class ArticlesImportWordPress, there is a method, createArticle, and in it, reads the xml to read the post_type, with this line of code :

      $postType = (string)$this->getXPath($item,'wp:post_type');


      This is emptly, and nothing happens.

      I have moved the line that gets the namespace "wp" :

      $wp = $item->children('wp',true);


      before this line, at the first position of the method, and changed the read of post_type by :


      $postType = (string)$wp->post_type;



      So, the method looks like this :

          public function createArticle(SimpleXMLElement $item) {
      	
      		$wp = $item->children('wp',true); // 2018-09-27 . moved here
              //$postType = (string)$this->getXPath($item,'wp:post_type');
              $postType = (string)$wp->post_type;
              if ($postType != 'post') return false;
              $settings = $this->container->getContainerSettings();
              $creator = $this->matchCreator((string)$item->xpath('dc:creator'.'/text()'),1);
              /** @var SimpleXMLElement $wp */
      		//$wp = $item->children('wp',true);	// 2018-09-27 . moved
              $pubDate =  strtotime((string)$item->pubDate);
              if (empty($pubDate)) {
                  $pubDate = strtotime((string)$wp->post_date);
              }
      
              /** @var Article $article */
              $article = $this->modx->newObject('Article');
              $article->fromArray(array(
                  'parent' => $this->container->get('id'),
                  'pagetitle' => $this->parseContent((string)$item->title),
                  'description' => $this->parseContent((string)$item->description),
                  'alias' => $this->parseContent((string)$wp->post_name),
                  'template' => $this->modx->getOption('articleTemplate',$settings,0),
                  'published' => $this->parsePublished($item),
                  'publishedon' => $pubDate,
                  'publishedby' => $creator,
                  'createdby' => $creator,
                  'createdon' => strtotime((string)$wp->post_date),
                  'content' => $this->parseContent((string)$item->children('content',true)->encoded),
                  'introtext' => $this->parseContent((string)$item->children('excerpt',true)->encoded),
                  'show_in_tree' => false,
                  'class_key' => 'Article',
                  'context_key' => $this->container->get('context_key'),
              ));
              $article->setArchiveUri();
              $article->setProperties($settings,'articles');
      
              if (!$this->debug) {
                  $article->save();
              }
      
              $this->importTags($article,$item);
              $this->importComments($article,$item);
              return $article;
          }