feedzy-rss-feeds icon indicating copy to clipboard operation
feedzy-rss-feeds copied to clipboard

Wordpress user is not assigned as author when the import is made with the cron job

Open irinelenache opened this issue 1 year ago • 2 comments

Description

Wordpress user is not assigned as author when the import is made with the cron job. When the import is made with the Run now button, it works fine.

Import with run now - https://vertis.d.pr/i/GvxeaR Import with cron job - https://vertis.d.pr/i/oTPV0P

Reported here - https://wordpress.org/support/topic/cron-imports-the-posts-without-the-author/

Step-by-step reproduction instructions

  1. Create an import
  2. Run it with the run now button
  3. Purge & reset the import
  4. Install WP Crontrol plugin and run the feedzy cron job

Screenshots, screen recording, code snippet or Help Scout ticket

Import with run now - https://vertis.d.pr/i/GvxeaR Import with cron job - https://vertis.d.pr/i/oTPV0P

Reported here - https://wordpress.org/support/topic/cron-imports-the-posts-without-the-author/

Environment info

WordPress 6.4.3 / Feedzy 4.4.2

Is the issue you are reporting a regression

Yes, this is a regression.

irinelenache avatar Feb 08 '24 10:02 irinelenache

After the investigation, this is not a bug. When the cron runs and no user is logged in, it marks that post_author as 0

The code that fetches the author is here: https://github.com/Codeinwp/feedzy-rss-feeds/blob/0c044f6ee263b6226ae932bb3e0e6f18e9884964/includes/admin/feedzy-rss-feeds-import.php#L2731-L2736

The behavior of fetching the user: https://developer.wordpress.org/reference/functions/wp_get_current_user/


@vytisbulkevicius, should we set the default author as admin?

Soare-Robert-Daniel avatar Feb 09 '24 14:02 Soare-Robert-Daniel

@irinelenache,

I thought as well that even with cron run in the past we were assigning the user who originally created the import job as the author but I can't find the proof of it in old tickets or related GitHub issues so it probably always worked like this.

We have a clean solution of passing any existing user as author when configuring import Job, it's here - https://docs.themeisle.com/article/942-in-feedzy-how-do-i#pass-author-ID

I think it fully covers this issue and is even more flexible.

I'm putting this in a backlog now, we can see if it's important to use the creator of the import job as the author based on more requests.

vytisbulkevicius avatar Feb 14 '24 09:02 vytisbulkevicius