Skip to content

Commit a28b1ca

Browse files
committed
Display notice to users to activate account incase they access settings page directly.
1 parent bc5e682 commit a28b1ca

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

includes/class-mailchimp-admin.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,31 @@ public function admin_notices() {
344344
<?php
345345
}
346346

347+
// Display a notice if the user is waiting for the login to complete.
348+
$current_screen = get_current_screen();
349+
if ( $current_screen && 'toplevel_page_mailchimp_sf_options' === $current_screen->id ) {
350+
$api = mailchimp_sf_get_api();
351+
if ( $api && 'waiting' === get_option( 'mailchimp_sf_waiting_for_login' ) ) {
352+
$profile = $api->get( '' );
353+
if ( ! is_wp_error( $profile ) ) {
354+
if ( ! empty( $profile['last_login'] ) ) {
355+
// Clear the waiting flag if the user is logged in.
356+
delete_option( 'mailchimp_sf_waiting_for_login' );
357+
} else {
358+
?>
359+
<div class="notice notice-warning is-dismissible">
360+
<p>
361+
<?php
362+
esc_html_e( 'Please activate your Mailchimp account to complete the setup. Without activation, the connection to WordPress may be interrupted.', 'mailchimp' );
363+
?>
364+
</p>
365+
</div>
366+
<?php
367+
}
368+
}
369+
}
370+
}
371+
347372
if (
348373
! get_option( 'mailchimp_sf_auth_error', false ) ||
349374
! get_option( 'mailchimp_sf_access_token', '' )

0 commit comments

Comments
 (0)