Automattic / Automattic/newspack-migration-tools

Add support for CAP helper usage with and without Guest Authors enabled

Open
#41 2 comments 1 reaction 1 assignee Claimed by @jorostoyanov View on GitHub
Dominant language
PHP
Stars
20
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Currently, the `CoAuthors_Helper` performs three checks when instantiated:
* CAP is installed and activated
* `global $coauthors_plus;` contains an instance of `CoAuthors_Plus`
* `$coauthors_plus->guest_authors` contains an instance of `CoAuthors_Guest_Authors`

However, CAP allows disabling the Guest Authors feature by setting the `coauthors_guest_authors_enabled` filter to `false`.

For example, the Newspack plugin registers a new User role called "Guest Contributor". By default, this deactivates the Guest Authors feature of CAP, unless the site in question has already registered Guest Authors.

We need to remove the **`$coauthors_plus->guest_authors` contains an instance of `CoAuthors_Guest_Authors`** check and use it only when Guest Authors are actually enabled.

Turning off this check, however, will lead to errors when using any of the `*_guest_author_*` methods.

We need to:
* either split the `CoAuthors_Helper` class and move the Guest Authors logic to another one
* check if Guest Authors are available in each of the methods that use it **(not recommended)**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.