Wordpress Post Sync - import not working

Do you have any plugins that modify images, media library or image handling at your site?

I have few plugins who may do this :

  • Regenerate Thumbnails
  • Recent Posts Widget With Thumbnails
  • Jetpack (I have an option to optimize image loading)

After digging through the Patreon Wordpress (patreon-connect) plugin code, I’ve found the method Patreon_Content_Sync::check_replace_patreon_images_with_local_images must be always called with 3 parameters, but the third parameter $post_id is missing when being called in Patreon_Content_Sync::add_new_patreon_post method, throwing the fatal error and interrupting the post import. This only happens if there are some images in the post content.

For the record, I’ve been developing a quick fix by doing the following in the patreon-connect/classes/patreon_content_sync.php file:

  • move the lines 168:172 to line 203 (handle images after post has been inserted)
  • add $inserted_post_id as 3rd parameter to $this->check_replace_patreon_images_with_local_images
1 Like

Yes, indeed - thats why i asked: when the image processing functions cannot identify or pass in between them the image or detect the attachment, this issue may happen.

What is the Jetpack image feature you are using?

This is my settings

Can you try disabling Jetpack for a while and start an import and see if this will make any difference?

Unfortunately it does not work. I could only make the import thanks to the modification i was talking about earlier.

Are the images properly coming in right now, or still not?

Yes the initial import is finally done, thanks to the little fix I’ve written down in one of my previous comments.

This is a good find. A better way to do it may be to separately set the featured image by processing already inserted post. This will prevent having to update the post immediately after inserting to have the images added. Ill arrange a package with this change and i will provide it soon.

The below branch is now updated with the changes based on your finding:

Just give it a try and let me know.

If its easier, here is a zipped package from dropbox which you can directly install after deleting your existing Patreon Wordpress:

1 Like

Hello, I am having the same issue with importing my posts. However, I am not as savvy as the other person who was having an issue. I have no idea how to fix or look at my web host logs. Is there any way that you could walk me through how to fix this issue. Thank you in advance. Chantelle

What’s the exact issue Chantelle? Posts not importing despite WP saying a post import is in progress?

Yes, it has said post importing for over a day but nothing is happening. Thank you for the quick response.

This would point to a potential problem with cron or connectivity issues at your WP site. You may debug cron using cron plugins if you know how to. Or you can ask your host about this. Your host may be blocking connections to Patreon.

Since there are other people experiencing the same, im going to look into adding a manual importer which will allow you to directly click to import next round of posts until they are all imported without requiring the cron. But this will likely go out in the next 7 days.

Until then you may try debugging your cron, or just wait. I recommend trying to look into whether cron works properly at your site and also asking your hos whether they have any security features that block Patreon though.

Thank you so much. I have no clue what cron is. I will do some investigating but will likely end up waiting the seven days. If I happen to figure this cron out before then I will let you know.
Thanks again,
Chantelle

Yes, just waiting would be easier.

But still, you can just contact your host about security measures and ask them whether they may be filtering Patreon.

In the meantime, you can visit ‘Patreon Settings’ menu’s ‘Health check’ submenu at your site, and copy/paste the log from there to the forum. There may be some clues there.

A tested and working state of manual post import is available:

You can deactivate/delete your existing Patreon WordPress and upload/activate the above package.

At the ‘Star a post import’ section of Patreon Settings, you can now manually import posts. When you start a post import, the section will transform into an ‘Ongoing post import’ state, allowing you to import the next batch of posts by clicking ‘Import next batch’ button which will appear. You can do this every 10 seconds.

The status messages will guide you through the import.

Here is the error message showing on my health check:

Response code: 401 Response :{“errors”:[{“code”:1,“code_name”:“Unauthorized”,“detail”:“The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn’t understand how to supply the credentials required.”,“id”:“6fa70f3a-b86a-4e45-a673-9fe025dfade1”,“status”:“401”,“title”:“Unauthorized”}]}