Dude, Where's My Article: Disappearing Articles

Why Articles blog posts disappear, and how to get them back


It's time to create new post in your MODX Articles Blog. You right-click on your blog container in the tree and select "Write New Article." The form to create a new blog post comes up, you spend a hour or two writing your blog post, set it as published, and click on the "Save" button. Now, you go to the front end and look at your blog. The new article is not there. You go to back to the Manager and navigate to the Manage Articles panel. It's not there either, nor is it in the Resources tree at the left. Is all your work lost forever? What happened?

First of all, no, your work is not lost, it's just hiding. The problem is due to a bug in Articles 1.6.5 and earlier versions. It should be fixed in later releases. If you create an articles by right-clicking in the tree, two fields of the article are set incorrectly. The class_key field, which should be set to Article, is set to modDocument and the show_in_tree field, which should be set to 0, is set to 1.

Until this bug is fixed, you should create articles from the Manage Articles panel. But what about your missing post? Here's how to bring it back from the dead.

The fix is relatively simple:

  1. Log in to your site's cPanel
  2. Go into PhpMyAdmin (in the Databases section)
  3. On the left, select your site's database
  4. Find the modx_site_content table and click on its browse link
  5. Each row is a Resource. Find the missing one.
  6. Click on the Edit button for the row of your Resource
  7. Change the class_key field from modDocument to Article
  8. Change the show_in_treefield from 1 to 0
  9. Click on the "Go" button at the bottom of the page

Tip: When searching the modx_site_content table, you can click on the ID column header to sort the Resources by ID. If you click again, it will reverse the sort and your new Resource should be at or near the top.

That's all there is to it. Your new blog post should now reappear in all its glory. Have a beer.

[Update] The bug discussed in this post was fixed by JP DeVries in Articles 1.6.6.



Comments (2)

  1. Ian MorganJun 04, 2013 at 11:07 AM

    I've just created a wee plugin to combat this.
    The code will update class_key from "modDocument" to "Article" and show_in_tree from "1" to "0" if the template is an article template (mine are id#s 15 and 24).

    The plugin is set to run on OnDocFormSave
    Seems to work...
    Hope this is of use to someone :-)


    if (($resource->get('class_key')
    == "modDocument")
    && ($resource->get('template') == "15"
    || $resource->get('template') == "24")) {
    $resource->set('class_key', 'Article');
    $resource->set('show_in_tree', '0');
    $resource->save();
    }

  2. Bob RayJun 05, 2013 at 12:09 AM

    Thanks!

    I think there's also a pull request pending to fix it within Articles.


Please login to comment.

  (Login)