Quick update to the Docs to WordPress plugin

We’ve released a quick update to the Docs to WordPress plugin that allows the plugin to integrate with WP Cron rather than requiring you to create your own file to run cron against (though you can still do that, too). To take advantage of it, you’ll have to upgrade to the latest version and edit your wp-config file to define at least three variables:

DOCSTOWP_USER: Your Google Docs username

DOCSTOWP_PASS: Your Google Docs password

DOCSTOWP_ORIGIN: The ID of the origin folder you want to draw the docs from

DOCSTOWP_DESTINATION: This one’s optional, but if defined it will put the docs in this folder when everything is finished processing.

To define a variable:

[php]define( ‘DOCSTOWP_USER’, ‘example@gmail.com’ );[/php]

To get the ID of the folder, look to the URL. It will look something like this:

https://docs.google.com/#folders/folder.0.!–ID STARTS HERE, AFTER THE 0 and the period –!

A quick note: I decided to hardcode the variables in wp-config instead of using a setting because I’d rather store a plaintext password on the server than in the database. Obviously, neither are ideal, so if anybody has a better solution I’m all ears.

29 thoughts on “Quick update to the Docs to WordPress plugin”

  1. I’m still having trouble transfer docs into wordpress. I copy a portion of this docs folder id: folder.0.<–start here 0BwJkzRQCxzFvYTgyNDVlNGQtMzRjMi00ZjRlLWJlMTEtMDFlYWFmY2Q1YTdi

    to define('DOCSTOWP_ORIGIN', 'id_goes_here');

    Still, nothing is transferred.

  2. Great plugin made even better with this extension. Took me a few minutes to realise that XAMPP has curl turned off by default, but worked great after fixing this.

    Thanks for sharing.

    1. Yeah, I should use the WordPress HTTP API instead of curl, I just haven’t gotten around to that part yet.

    1. I can’t see exactly what you’re doing because you’re using a local server and not an outward-facing server, but you can’t activate plugins specifically for pages, just for the entire site. To get Google Docs content on a specific page you’d have to copy and paste the content over. What the plugin will do is aid in moving content from a Google Doc to a WordPress post.

  3. Very cool plugin! Installed it quickly and painlessly on WP 3.1.3. It is pulling my docs in accurately and the comment/code stripping is working well. The only thing I cannot get to work is using the | character to signify the title. The document title is being used for both the slug and the post title and the title along with with the pipe character is being added into the body copy.

    To confirm, on my UK keyboard, the | character is: Shift + \

    What can I do here?

    Thanks for sharing your plugin. It is really cool! I look forward to seeing how it develops.

    1. Ben,
      Sorry for not replying sooner. It seems I shut off my email alerts by accident.

      The ID in this instance is 0B_ebshLIqsz_MzI5MTliZjQtZWMxYS00MDFjLWE5ZWItMTNhOWY3MjJmZjZj.

  4. It’s a nice plug-in. Thanks!
    It works well with texte type documents, but I get a “Unauthorized Error 401” content for spreadsheet type documents.
    Is that normal behaviour or an issue with my parameters?

    Also, I don’t get what is the “DOCSTOWP_DESTINATION”. What is it for?
    Is that a googleDoc collection or a folder on the server? What’s the syntax (trailing /?)

    1. Phillipe,
      Sorry for not replying sooner. It seems I shut off my email alerts by accident.

      Right now we don’t support spreadsheets, just text docs. We recommend embedding spreadsheets, drawings, etc. in a post.

      The DOCSTOWP_DESTINATION is if you want all the docs to go into a different collection after they go through the process. We use this so we can easily tell if a doc has been published, because it will then be in our ‘published’ collection. If you leave that undefined it will just remove the doc from your action folder.

  5. Will – Thank you for creating this, thank you sharing it, and thank you for open sourcing this… really awesome… thank you… and now I have a bunch of questions…

    The plugin in the WP Repo appears newer (0.2-beta) than what is currently on the GitHub repo… Is there a current git repo? different git repo? Are you no longer working/updating the git repo? Not at all complaining, and I’m not ready to fork it yet, but I might and would just as soon start in the right place.

    Is the InDesign plugin going to be open sourced? or has it already been and I just haven’t found it?

    Does the InDesign plugin use xtags or is it completely stand alone?

    1. Jon,
      I need to update the github repo, just haven’t gotten around to it yet. I’ll put that on my to-do list.

      The InDesign plugin isn’t nearly ready for general consumption yet, but we’re hoping to get there soon.

    2. To answer your other question about the InDesign plugin, it converts content from WordPress to InDesign Tagged Text for import onto the page.

      1. Thank you Will for both replies. Might the InDesign plugin be available for private consumption? or collaboration? I may contact you out of comments for more info…

  6. I’ve set this up and it works perfectly. The hardest part of the setup was figuring out the right folder ID. While everything from Google Docs transfers easily and quickly, all the formatting is stripped out (bold, italic, etc., that kind of formatting). Is there a setting that needs to be adjusted to keep the formatting during the transfer?

    1. Gary,
      I’m actually working on an update to the plugin right now that will (hopefully) fix that. Currently, though, it’s an all-or-nothing sort of thing — either keep all the formatting or lose all of it.

  7. Great plugin.

    My understanding of “coding” (for lack of a better term) is rather juvenile, so I’ll do my best to explain my issue.

    With my publication’s WordPress, we use Flutter to create Custom Write Panels so that we can add the writer’s name, photographer, photo caption, etc. When the script pulls the gDoc into WP, these Custom Write Panels are lost in the saved draft.

    Any insight is appreciated.

  8. I am helping a friend to move her monthly, regional newspaper to WordPress. She really likes the idea that contributors can email their articles to google docs, like BDN did, and she can review them and send to WordPress — then to InDesign.

    I’m sure there have been many improvements since 2011.

    Are you aware of a plug-in to make this happen?

    Thanks!

    John M.

  9. Thanks WIlliam for the amazing plugin

    I tried deploying it but it did not work, I enabled debugging mode, and I found that the curl request in function getInfoFiles returns “Token Invalid , Error 401”

    Any clue why I am getting this ?

Leave a Reply

Your email address will not be published. Required fields are marked *