Skip to content

Commit

Permalink
Display notice to users to activate account incase they access settin…
Browse files Browse the repository at this point in the history
…gs page directly.
  • Loading branch information
iamdharmesh committed Sep 10, 2024
1 parent bc5e682 commit a28b1ca
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions includes/class-mailchimp-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,31 @@ public function admin_notices() {
<?php
}

// Display a notice if the user is waiting for the login to complete.
$current_screen = get_current_screen();
if ( $current_screen && 'toplevel_page_mailchimp_sf_options' === $current_screen->id ) {
$api = mailchimp_sf_get_api();
if ( $api && 'waiting' === get_option( 'mailchimp_sf_waiting_for_login' ) ) {
$profile = $api->get( '' );
if ( ! is_wp_error( $profile ) ) {
if ( ! empty( $profile['last_login'] ) ) {
// Clear the waiting flag if the user is logged in.
delete_option( 'mailchimp_sf_waiting_for_login' );
} else {
?>
<div class="notice notice-warning is-dismissible">
<p>
<?php
esc_html_e( 'Please activate your Mailchimp account to complete the setup. Without activation, the connection to WordPress may be interrupted.', 'mailchimp' );
?>
</p>
</div>
<?php
}
}
}
}

if (
! get_option( 'mailchimp_sf_auth_error', false ) ||
! get_option( 'mailchimp_sf_access_token', '' )
Expand Down

0 comments on commit a28b1ca

Please sign in to comment.