| 1 |
<?php |
| 2 |
/** |
| 3 |
* Newsletter opt-in section |
| 4 |
* |
| 5 |
* Rendered inside the welcome step, below the feature grid. The checkbox is |
| 6 |
* unticked by default: nothing is sent unless the administrator opts in. |
| 7 |
* Submitted when the user moves on with "Get Started" — see subscribeSubmit() |
| 8 |
* in the setup wizard script. |
| 9 |
*/ |
| 10 |
|
| 11 |
namespace UltimatePostKit\SetupWizard; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
// Template partial: the variables below are file-scoped for this view, not |
| 18 |
// plugin globals, so the global-prefix rule does not apply. |
| 19 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View-local variables. |
| 20 |
|
| 21 |
$current_user = wp_get_current_user(); |
| 22 |
|
| 23 |
$subscribe_email = ''; |
| 24 |
if ( $current_user && is_email( $current_user->user_email ) ) { |
| 25 |
$subscribe_email = $current_user->user_email; |
| 26 |
} else { |
| 27 |
$subscribe_email = get_option( 'admin_email' ); |
| 28 |
} |
| 29 |
|
| 30 |
// Opt-in only: the box is ticked solely when the administrator opted in before. |
| 31 |
$subscribe_optin = 'yes' === get_option( 'bdtupk_subscribe_optin' ); |
| 32 |
|
| 33 |
?> |
| 34 |
|
| 35 |
<div class="bdt-setup-wizard-subscribe"> |
| 36 |
|
| 37 |
<div class="bdt-subscribe-card"> |
| 38 |
|
| 39 |
<div class="bdt-subscribe-card-head"> |
| 40 |
<span class="bdt-subscribe-guarantee"> |
| 41 |
<i class="dashicons dashicons-shield-alt"></i> |
| 42 |
<?php esc_html_e( 'NO SPAM GUARANTEE', 'ultimate-post-kit' ); ?> |
| 43 |
</span> |
| 44 |
</div> |
| 45 |
|
| 46 |
<div class="bdt-subscribe-field"> |
| 47 |
<input type="email" |
| 48 |
id="bdt-subscribe-email" |
| 49 |
class="bdt-subscribe-email" |
| 50 |
name="bdt_subscribe_email" |
| 51 |
autocomplete="email" |
| 52 |
placeholder="<?php esc_attr_e( 'Enter your email address', 'ultimate-post-kit' ); ?>" |
| 53 |
value="<?php echo esc_attr( $subscribe_email ); ?>"> |
| 54 |
</div> |
| 55 |
|
| 56 |
<div class="bdt-subscribe-consent"> |
| 57 |
<label class="bdt-subscribe-consent-label" for="bdt-subscribe-consent"> |
| 58 |
<input type="checkbox" |
| 59 |
id="bdt-subscribe-consent" |
| 60 |
class="bdt-subscribe-consent" |
| 61 |
value="yes" |
| 62 |
<?php checked( $subscribe_optin ); ?>> |
| 63 |
<span> |
| 64 |
<?php esc_html_e( 'Email me the BdThemes newsletter: product news, tips and security notices. You can unsubscribe at any time.', 'ultimate-post-kit' ); ?> |
| 65 |
</span> |
| 66 |
</label> |
| 67 |
</div> |
| 68 |
|
| 69 |
</div> |
| 70 |
|
| 71 |
</div> |
| 72 |
|