publishpress / PublishPress-Authors

PublishPress Authors is the best plugin for adding many authors to one WordPress post. You can create multiple authors, co-authors and guest authors.
14 stars 8 forks source link

Authors profiles are automatically created for users in post_author for any post type when get_multiple_authors is called for the post #464

Closed andergmartins closed 3 years ago

andergmartins commented 3 years ago

It looks like every new customer on EDD gets an author profile. Maybe we have a conflict with the EDD plugin?

stevejburge commented 3 years ago

I can confirm this on PublishPress and TaxoPress

andergmartins commented 3 years ago

For EDD, the issue occurs only when the payment is completed. It won't be reproducible using the test payment. Only Strip or PayPal on test mode, at least.

When EDD creates the payment register, it creates a post of type edd_payment. The post_author on that post is the new client. The user that just bought the plan.

After this point, this is an issue for any plugin that follows the next steps, so not exclusive to EDD.

The issue starts when the filter user_has_cap is applied for the created post. The method allow_coauthors_edit_post is called, which calls is_multiple_author_for_post. It then calls get_multiple_authors, which has the bug itself.

The fix for issue #396 introduced the bug. The fix was intended to automatically fix the post and author relationship whenever it is detected the post has no author terms. It would work well if all the authors in custom post types should be added as Author on the site. That is not true, so we could still keep the code that fixes the post and author relationship, but remove the code that automatically creates the author for the specific user. If the user is an author already, we fix the relationship. If not, we add a message to the error log (if WP_DEBUG is enabled). Another option is still to create the author, but only if the queried post is activated for the Authors plugin.

stevejburge commented 3 years ago

Thanks for catching it, and the detailed explanation @andergmartins

andergmartins commented 3 years ago

It is important to mention that no user role or capability is changed when the author is being created, only the respective term of taxonomy author.