Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
irinelenache opened this issue Feb 8, 2024 · 2 comments
Labels
bug This label could be used to identify issues that are caused by a defect in the product. customer report Indicates the request came from a customer. small (1-3h) This label is used for issues that can be completed within 3 hours or less.

Comments

@irinelenache
Copy link

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 irinelenache added bug This label could be used to identify issues that are caused by a defect in the product. customer report Indicates the request came from a customer. labels Feb 8, 2024
@pirate-bot pirate-bot added the regression Issue represents a change in behavior from a previous version that is not intended or desired.. label Feb 8, 2024
@vytisbulkevicius vytisbulkevicius added the Priority-Medium Expected resolution time - up to 1 month. label Feb 8, 2024
@vytisbulkevicius vytisbulkevicius removed the regression Issue represents a change in behavior from a previous version that is not intended or desired.. label Feb 8, 2024
@Soare-Robert-Daniel
Copy link
Contributor

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:

$current_user = wp_get_current_user();
$new_post_author = $current_user->ID;
// new post data array
$args = array(
'post_author' => $new_post_author,

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 Soare-Robert-Daniel added the small (1-3h) This label is used for issues that can be completed within 3 hours or less. label Feb 12, 2024
@vytisbulkevicius
Copy link
Contributor

@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 vytisbulkevicius removed the Priority-Medium Expected resolution time - up to 1 month. label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This label could be used to identify issues that are caused by a defect in the product. customer report Indicates the request came from a customer. small (1-3h) This label is used for issues that can be completed within 3 hours or less.
Projects
None yet
Development

No branches or pull requests

4 participants