I think an update to PHP 7.4 by GoDaddy finally killed this for me. Had a problem with it self-deleting on one site yesterday afternoon, only to discover it started doing it on all eight of my sites. Was throwing this error:
Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in /home/…/docs-to-wordpress/purifier/HTMLPurifier.standalone.php on line 10994
Also on line 11000 and I have no knowledge of PHP on how to update/fix it. Tried pushing it up to PHP 8 and that fried the whole site – something about curly bracket syntax in the same file.
So, I’m looking for a new solution. Nothing so far seems as easy or elegant as this. Open to suggestions.
Thanks.
]]>What rules should be added to this code to display larger or smaller text?
`//PHP doesn’t honor lazy matches very well, apparently, so add newlines
$raw = str_replace( ‘}’, “}\r\n”, $raw );
preg_match_all( ‘#.c(?P<digit>\d+){(.*?)font-weight:700(.*?)}#’, $raw, $boldmatches );
preg_match_all(‘#.c(?P<digit>\d+){(.*?)font-style:italic(.*?)}#’, $raw, $italicmatches);
if( !empty( $boldmatches[ ‘digit’ ] ) ) {
foreach( $boldmatches[ ‘digit’ ] as $boldclass ) {
$raw = preg_replace( ‘#<span class=”(.*?)c’ . $boldclass . ‘(.*?)”>(.*?)</span>#s’, ‘<span class=”$1c’ . $boldclass . ‘$2″>$3</span>’, $raw );
}
}
if( !empty( $italicmatches[ ‘digit’ ] ) ) {
foreach( $italicmatches[ ‘digit’ ] as $italicclass ) {
$raw = preg_replace( ‘#<span class=”(.*?)c’ . $italicclass . ‘(.*?)”>(.*?)</span>#s’, ‘<span class=”$1c’ . $italicclass . ‘$2″>$3‘, $raw );
}
}
]]>Hi all.
I changed two things in the last week and now my Docs to WordPress is doing weird things. It will import a handful of files (so far b/w 2-5), but when it goes to grab more, it will overwrite the last post.
For instance, say we’re grabbing files 1-10 from Drive. We’ll get:
Post 1
Post 2
Post 3
And then that’ll change to:
Post 1
Post 2
Post 4
then:
Post 1
Post 2
Post 5
Until it goes through the entirety of files. Also, the files in Drive are being appropriately moved from Origin to Destination – they’re just not propagating individual posts.
Has anyone else encountered this? I don’t know if it’s because we’ve implemented CloudFlare since our last set of imports (I switched CloudFlare into Developer Mode to see if that would remedy the situation, but no dice) or did the recent update to WordPress 5.7 finally do us in?
I’m currently backstepping one of our sites to 5.6.1 to see what happens. But if anyone has any idea on what could be causing this, please let me know.
Thanks.
]]>Has anyone else seen this error, and, if so, should I be worried, or let it ride?
Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in?/home/sewo3em3r1f1/public_html/sun/wp-content/plugins/docs-to-wordpress/purifier/HTMLPurifier.standalone.php?on line?10994
Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in?/home/sewo3em3r1f1/public_html/sun/wp-content/plugins/docs-to-wordpress/purifier/HTMLPurifier.standalone.php?on line?11000
Also, I had panicked because I thought there was some sort of breakdown with the plugin. It’s been really sketchy grabbing files from GDocs for awhile now. Finally broke down and called GoDaddy. Turns out with their latest updates to Managed WordPress hosting accounts no longer support CRON jobs. So now my day is migration and I’ve already honked it up. What joy!
]]>I’m hoping there are still folks reading this forum.
I’ve used docs-to-wp for a few years to help out with a small student magazine (www.locomag.com). I’ve been able to set it up by following directions but when anything breaks I’m essentially a helpless baby.
So of course, sometime within the last 5 months or so, the Docs to WP link in the Settings Menu of the WP Dashboard leads to this screen
https://www.dropbox.com/s/r8q0gv3xz5eyopz/appnotverified.jpg?dl=0
I’ve tried to go into my Google account to allow access to the app, to configure the OAuth consent screen, etc but as I said I am a helpless baby and can’t seem to figure out how to get this to work again. I’m thinking of just uninstalling the plugin entirely and trying to start over but hopefully someone here might be able to help out first?
Thanks in advance!
]]>Back again for my annual wrestling match. My publisher is expanding and, as part of that, looking to move all the production Google Drive folders into Team Drives, the latest G Twist.
Just wondering if anyone’s tried this; I’ve started trying, but I stopped after getting an error when I tried to change the destination folder (in the plug-in settings) from this
https://drive.google.com/folderview?id=0B_1o2x1io1P0ZTA2ZjllZDctY2M3YS00NWIzLWFiMTktYzI4ZTIyYTIyZjA4
to this
https://drive.google.com/folderview?id=0ACOr2rJLmSGOUk9PVA
Both of these URLs resolve/redirect just fine in the browser to the standard Drive URLs, which are slightly different — meaning, in the case of the new link, the following
https://drive.google.com/drive/folders/0ACOr2rJLmSGOUk9PVA
But the old one works; the new Team Drive link, which has a significantly shorter unique ID, does not. The error log on the web server is not at all helpful:
[Tue Jan 30 12:59:49.014224 2018] [:error] [pid 4455] [client XX.XXX.XXX.XXX:47060] https://docs.google.com/feeds/download/documents/export/Export?id=1fDH2DwbqhpOJ9q6O5-8CE4UwIbiXqL2xdGq981G8EVE&exportFormat=html
I have NOT tried changing the origin folder setting, since I’m pretty sure that will just break the plug-in. Right now, with the origin folder still set at the same old Google Drive folder as before, it still transfers the Doc successfully to WP.
@tararebeka, you out there still fighting the good fight?
]]>Hello…
First off .. Fantastic plugin!
Has anybody played around with hacking the code, so more data gets automatically placed in wordpress?
The title gets separated from body text by the pipe symbol (|) according the the headline delimiter file.
Our newspaper uses the excerpt field as a subheading and I thought you could do something like this in the google docs document
title |
subheader |
byline |
body text
When I look at the headline delimiter, it uses the explode function to separate the title and body text. But couldn’t you do something like:
$post_array[ ‘post_title’ ] = strip_tags( $exploded_fields[ 0 ] );
$post_array[ ‘post_excerpt’ ] = strip_tags( $exploded_fields[ 1 ] );
$post_array[ ‘custom_field_author’ ] = strip_tags( $exploded_fields[ 2 ] );
$post_array[ ‘post_content’ ] = strip_tags( $exploded_fields[ 3 ] );
Hope my question makes sense.. I figured the more data I could place correctly in wordpress the less work it requires afterwords ?? The reason we have a custom-field for authors is that we use it for reader submitted content and we don’t want to create a user for every person who writes a reader letter.
]]>Anyone having a problem today? Tried @tararebeka’s mysterious (but proven) tip for clicking the Save button on the D2WP settings page, but nothing’s moving, and there’s nothing in the error logs.
]]>I’m looking for a way to store the newsroom slug as a custom field. The headline extender is storing the post title correctly, but in GDocs, the newsroom uses slugs for the titles of the articles. I see some code in the extender about storing it, but it is getting lost. Storing it in a custom field is fine, I just want to maintain it in WP so that the editors, if they need to, can refer back to the original post.
]]>There is an older, closed thread about this here: https://www.ads-software.com/support/topic/copy-images-from-gdoc-to-wp/
Has anyone had any luck getting some image migration into WP to work?
]]>A year ago, in this closed thread, @mattdawsonuk mentioned running a modified version of the Docs-to-WP plugin’s extend-clean.php which stripped out Google’s tracking from hyperlinks.
Matt, if you’re out there, I’m gratefully using your other DTWP patch, which retains text formatting, bold and italic, but would love to know how to remove the Google tracking from Google Doc hyperlinks before they reach WordPress.
Thanks!
Roger
]]>Hi,
With no error during install (following video instruction) and with Docs to “WordPress extender-Run on Cron” activated, I saved some files to my Origin Google Drive Folder (bot doc and rtf).
But I still do not see drafts in my WP site.
What could be the reason?
]]>Hi,
I follow the step by step video and I’m stuck with the authorization google page.
I click ‘Autorized’ and nothing happens.
Any help ?
Thanks
]]>Hi,
I’m looking over your installation instruction as well as the video walkthrough you’ve provided, but I’m still a bit confused on how to setup this plugin. In the installation instruction you’ve said “Create a Google App for your website.”, can you explain that in more details. What app exactly should I developed.
Also in the video walk through right of the bat the instruction says “Make sure you’re already logged into your Google account and activate the 4 elements of the plugin”. what exactly do you mean by “activate the 4 element of the plugin”? what are those elements?
Any help would be greatly appreciated
]]>When I create the file docs_to_wordpress.php with the following text:
<?php
include(‘./wp-load.php’);
$docs_to_wp = new Docs_To_WP();
$result = $docs_to_wp->startTransfer();
wp_mail( “YOUR_EMAIL_ADRESS”, “Docs to WordPress”, print_r( $result, true ) );
It just returns a blank html file
If I change the address to my actual address I get an parse error in line 5 saying there is an unexected @
]]>Can anyone please help me get this activated? I have installed the plug-in and put all the information in the settings. It is connected to Google Docs. But then what? And how do I configure the In-Design script to get documents from WordPress.
]]>I have finally found some time to have a good look at this – as it was starting to become a real issue that i was loosing the bold and italic styling.
So i have inspected the code and got my head around how the bold and italic tags ‘should’ be applied. After reading through all the documentation i could find i noticed in the changelog that the latest version of the bold and italic support was added in 0.4-beta. The function (dtwp_extract_styles) that does this is found at lines 10-37 of extend-clean.php. However i noticed that this function is not being called in the latest 1.1v!
So i have implemented a quick and dirty fix which seems to be working for me well! There is probably a much more elegant solution but with my extremely limited php experience i am more than happy i was able to get it working by myself :-).
To do this i have merged some of the extend-clean.php code into the main docs-to-wp.php code.
The dtwp_extract_styles function is looking to the stylesheet that comes from google for a selector that is applying the property font-weight:bold to work out the class name any then use the correct class name to wrap the relevant span content with a strong tag. And the same for italic.
So the function needs to have the unmodified raw markup passed to it. In the docs-to-wp.php this is available as the $raw variable. So swapping out the old $content variable for $raw in the dtwp_extract_styles function seems to have done the trick ??
I have inserted the following code into the docs-to-wp.php at line 120 (at the start of the _cleanDoc function):
//PHP doesn't honor lazy matches very well, apparently, so add newlines
$raw = str_replace( '}', "}\r\n", $raw );
preg_match_all( '#.c(?P<digit>\d+){(.*?)font-weight:bold(.*?)}#', $raw, $boldmatches );
preg_match_all('#.c(?P<digit>\d+){(.*?)font-style:italic(.*?)}#', $raw, $italicmatches);
if( !empty( $boldmatches[ 'digit' ] ) ) {
foreach( $boldmatches[ 'digit' ] as $boldclass ) {
$raw = preg_replace( '#<span class="(.*?)c' . $boldclass . '(.*?)">(.*?)</span>#s', '<span class="$1c' . $boldclass . '$2"><strong>$3</strong></span>', $raw );
}
}
if( !empty( $italicmatches[ 'digit' ] ) ) {
foreach( $italicmatches[ 'digit' ] as $italicclass ) {
$raw = preg_replace( '#<span class="(.*?)c' . $italicclass . '(.*?)">(.*?)</span>#s', '<span class="$1c' . $italicclass . '$2"><em>$3</em>', $raw );
}
}
I hope this is useful for anyone else who is missing the bold and italic styling.
Matt
]]>Thanks to these forums, I got the plugin up and running again… sort of.
Docs will occasionally be pulled from the origination folder, posted and moved. But then they stop. Sometimes if I deactivate and reactivate the Run on Cron extender, things will start working again.
I’ve also gotten it to work at least once by deactivating and reactivating the main Docs to WP plugin (when my other method didn’t do anything).
At the moment nether options seems to be working for me. Any suggestions would be most appreciated!
]]>Hi.
I have recently updated to the ‘drive api’ version of the plugin and i am hitting a problem when granting permission in google.
I have created a google app project and input the values into the plugin settings page which has connected successfully. When i choose ‘docs to wp’ in the settings menu of WordPress it takes me to this page (See screenshot). But when i click ‘accept’ it seems to just reload the page.
Has anyone else experienced this or know what the problem is?
Any help would be greatly appreciated as i am tearing my hair out at the mo!
Thanks in advance.
Matt
]]>Is any of this coming?
A month or so after they said they’d shut off the old Docs API, Google finally did, sometime this week. The reason I know is because I had reverted to the old Docs to WP version since it was still apparently working and has served us without fail for three or four years —but mostly because the previous version at least transferred text attributes, links, categories (if they matched Drive folder names) and authors (if the lefthand side of their Gmail address matched their WP username). But none of this is working in version 1.1.
The new version transfers docs fine but none of those attributes, which in our case more than doubles the amount of time it takes to get stuff online from our Docs editing system.
I’m not great with php but if anyone has any hints (or is experiencing the same unexpected changes in 1.1), I would love to hear from you.
]]>Hello,
I’m no Google App pro and never had do set one up before.
After quite some trouble of finding the proper API keys and what not, I’ve now reached the final step. But I end up in a 400 error over at Google:
The redirect URI in the request: https://stockholmstypografiskagille.se/wp-admin/options-general.php?page=docs_to_wp did not match a registered redirect URI.
What to do? As I’m trying to change the entered settings in WP-plugin settings I only reach the Google account selection and the 400 again.
Any help to get me and others past this is much appreciated.
]]>Just when you thought it was safe to check back into the forums…
After getting over the hurdle yesterday, I had successfully got everything up in running in two sites. When I hit the third, no dice. Couldn’t figure out why – I was logged into the correct Google account, etc. – just wouldn’t work. I foolishly thought, ‘hey, I’ll just delete the API and start from scratch.’
Somehow the settings for the deleted API are cached somewhere, and even deleting and reinstalling the plugin won’t clear it. I get caught in a loop of ‘that API has been deleted’ whenever I try to get to the settings page. It won’t display the settings, it just jumps straight to the Google error page.
Magic eraser?
]]>We’ve been gratefully using this plugin since it was first released. But since the update this week, the Drive documents no longer transfer from the designated origin folder. We’re connected to the App fine, and the folder IDs are correct on the Docs to WP settings page. Updated the main plug-in, which seems to have also updated the other three separate plug-ins listed on our plug-in admin page to 1.0 Beta — “Docs to WordPress extender – clean content, strip comments,” “Docs to WordPress extender – Headline delimiter” and “Docs to WordPress extender – Run on Cron (every minute)”
Checked and there is no “DEFINE disable cron” statement in our wp-config.php file, so I’m not sure why nothing’s moving, and any hints about troubleshooting would be appreciated.
Also, separate issue: Activating the Docs to WP plug-in also seems to break some of the Ajax features of other plug-ins on the admin side, specifically of an Event Calendar Pro date-picker and the Authors Plus multiple author chooser; wondering if there’s a jquery conflict happening somewhere, but again any hints about troubleshooting appreciated.
Thanks,
Roger
1. With the new Options/API menu on the dashboard, is it still necessary to have the Google log/pass and Origin/Destination information in the wp-config? Will having it in there conflict with the 1.0 beta version?
2. If running a separate CRON file, does it also still need the Google info, or just the four lines noted in the new install notes.
3. The Connection Status keeps showing ‘Error!’ When I click the reconnect, it goes to the API prompt for offline access. When I authorize, it gives a new Refresh Token, but still shows ‘Connection Status: Error!’ Each time I try to reconnect, I go through the loop again. Is that what’s supposed to happen?
Could not get it to work, so I reinstalled from scratch (still to no avail). I’ll be going back to the previous version for now, but still very happy to see continued development on this.
]]>It’s the strangest thing – no matter which folder I’m uploading in (drag or by using the arrow) my files somehow upload into the root directory. The first time I dragged my files into the correct folder, the script somehow stopped moving the files, or recognizing that a file had been imported. We lost two hours worth of work because the posts kept getting re-imported over the original.
I had to log out, then back in, then reset it to the ‘old’ look, which didn’t totally fix it. I still upload into the root, regardless of where I drag, but at least now I don’t have the ‘no move & overwrite’ issue.
Has anyone else experienced this? Is there a way to write a cron job that would pull those RTF files directly from a folder on our own server, or does the process have to include Google.
Gotta say, I totally freaked out – I launched all eight of our newspapers on October 1 using this process and thought I was totally screwed.
]]>I have installed the plugin and activated all but the clean content extender. I pasted the following code into the wp-config.php file
/** docs to wordpress */
define( 'DOCSTOWP_USER', '[email protected]' );
define( 'DOCSTOWP_PASS', 'XXXXXXXX' );
// Folder to Pull From
define( 'DOCSTOWP_ORIGIN', '0Bz_J3vTxSx3iaTY1VDhWSlhxNnc' );
// Folder to send to once published
define( 'DOCSTOWP_DESTINATION', '0Bz_J3vTxSx3iSTdSV2VaQk5XT3M' );
I am not receiving any errors, but the files I set up to test the plug in have not shown in wordpress. Is my code correct? Is there a specific place that I should add the code? I attempted the alternate route of adding the code to the wp-cron file but received errors. Here is the code I used in that instance:
include('./wp-load.php');
$docs_to_wp = new Docs_To_WP();
$gdClient = $docs_to_wp->docs_to_wp_init( '[email protected]', 'XXXXXXX' );
$docs_to_wp->retrieve_docs_for_web( $gdClient, '0Bz_J3vTxSx3iaTY1VDhWSlhxNnc','0Bz_J3vTxSx3iSTdSV2VaQk5XT3M' );
I would appreciate any help you could offer.
Thanks!
]]>I can’t seem to get this to work on my local server..
Followed all instructions – activated the plugins, set the google drive username and password, and folder id in wp-config. After I created a new document in drive, waited for at least a minute for the wp-cron to do its job, nothing happened to my wordpress. No post is published or saved as draft. Is there any indicator that it’s working?
Does this only work on hosted servers? I don’t want to use this in production just yet without knowing how the plugin will work…
Searching here and there yields very little answers. Most people seem to get it to work.
Please help.
]]>This may seem like a no-brainer to some, but I thought I’d put it out there. After last week’s Heartbleed breach, I enabled two-step verification on our corporate Google account.
This morning I received the dreaded ‘hey, we’ve updated WordPress for you!’ email. I put a test RTF file into GDrive and it wouldn’t port. I was certain that the new 3.8.3 had broken it.
After staring at the wall and trying to figure out what could actually be broken, I tried disabling the two-step verification.
Success.
It occurred to me that there’s no way the current script could handle the two-step process. I know next to nothing about scripting, but if more brilliant heads could prevail, maybe there’s a way to make it work. In the meantime, I’ve disabled two-step because I’d rather have this awesome plugin doing what I need it to do than covering my Google butt.
]]>It should note that there is a third variable that must be defined:
DOCSTOWP_ORIGIN
This variable should be the folder ID of the GDocs folder where your potential posts exist. The ID is after ‘0#folders/’ in the URL.
Also, there is an optional fourth variable:
DOCSTOWP_DESTINATION
According to Mr.Davis, “if defined it will put the docs in this folder when everything is finished processing.“
I uploaded my files to GDrive and they’re just sitting there. Usually they start posting to WordPress and moving directories immediately, but so far nothing.
It’s worth it for me to downgrade WP just to keep this series of plug-ins working. Please let me know if there’ll be an update or how to work around this.
Thanks.
]]>