From 9a81584e5771ea15d2d9e3e96a9d782ec9936f26 Mon Sep 17 00:00:00 2001 From: Adam Cassis Date: Fri, 25 Oct 2024 13:32:48 +0200 Subject: [PATCH] fix(co-authors-plus): CLI for migrating from CAP GA --- includes/cli/class-co-authors-plus.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/cli/class-co-authors-plus.php b/includes/cli/class-co-authors-plus.php index 06932ef81a..82d1493543 100644 --- a/includes/cli/class-co-authors-plus.php +++ b/includes/cli/class-co-authors-plus.php @@ -161,7 +161,7 @@ public function backfill_non_editing_contributor( $args, $assoc_args ) { $users = get_users( [ 'role__in' => [ 'subscriber', 'customer' ], - 'role__not_in' => [ \Newspack\Co_Authors_Plus::CONTRIBUTOR_NO_EDIT_ROLE_NAME, 'administrator', 'editor', 'author', 'contributor' ], + 'role__not_in' => [ \Newspack\Guest_Contributor_Role::CONTRIBUTOR_NO_EDIT_ROLE_NAME, 'administrator', 'editor', 'author', 'contributor' ], 'fields' => 'ID', 'number' => -1, ] @@ -170,7 +170,7 @@ public function backfill_non_editing_contributor( $args, $assoc_args ) { if ( count_user_posts( $user_id ) > 0 ) { // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.count_user_posts_count_user_posts if ( self::$live ) { WP_CLI::line( sprintf( 'Will add the Non-Editing Contributor role to user %d.', $user_id ) ); - get_user_by( 'id', $user_id )->add_role( \Newspack\Co_Authors_Plus::CONTRIBUTOR_NO_EDIT_ROLE_NAME ); + get_user_by( 'id', $user_id )->add_role( \Newspack\Guest_Contributor_Role::CONTRIBUTOR_NO_EDIT_ROLE_NAME ); } else { WP_CLI::line( sprintf( 'Would add the Non-Editing Contributor role to user %d.', $user_id ) ); } @@ -266,7 +266,7 @@ function( $value ) { 'user_nicename' => isset( $post_meta['cap-user_login'] ) ? $post_meta['cap-user_login'] : '', 'user_url' => isset( $post_meta['cap-website'] ) ? $post_meta['cap-website'] : '', 'user_pass' => wp_generate_password(), - 'role' => \Newspack\Co_Authors_Plus::CONTRIBUTOR_NO_EDIT_ROLE_NAME, + 'role' => \Newspack\Guest_Contributor_Role::CONTRIBUTOR_NO_EDIT_ROLE_NAME, 'display_name' => isset( $post_meta['cap-display_name'] ) ? $post_meta['cap-display_name'] : '', 'first_name' => isset( $post_meta['cap-first_name'] ) ? $post_meta['cap-first_name'] : '', 'last_name' => isset( $post_meta['cap-last_name'] ) ? $post_meta['cap-last_name'] : '', @@ -420,7 +420,7 @@ private static function migrate_linked_guest_authors() { self::assign_user_meta( $guest_author, $user_id ); // Add the Non-Editing Contributor role. - $linked_user->add_role( \Newspack\Co_Authors_Plus::CONTRIBUTOR_NO_EDIT_ROLE_NAME ); + $linked_user->add_role( \Newspack\Guest_Contributor_Role::CONTRIBUTOR_NO_EDIT_ROLE_NAME ); } }