| 1 |
<?php |
| 2 |
/** |
| 3 |
* Display the Welcome page. |
| 4 |
* |
| 5 |
* @author WP Charitable LLC |
| 6 |
* @package Charitable/Admin View/Welcome Page |
| 7 |
* @since 1.0.0 |
| 8 |
* @version 1.8.0 |
| 9 |
* @version 1.8.4 Revised for server-side onboarding. |
| 10 |
* @version 1.8.8.6 |
| 11 |
* @version 1.8.12.2 Reworded the onboarding "lostconnection" return message so it no longer tells the user they are logged out. |
| 12 |
*/ |
| 13 |
|
| 14 |
// Exit if accessed directly. |
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
exit; |
| 17 |
} |
| 18 |
|
| 19 |
// assemble a url to the setup wizard using WordPress function. |
| 20 |
$charitable_onboarding_url = charitable_get_onboarding_url(); |
| 21 |
|
| 22 |
// Enqueue the styles for the onboarding process. |
| 23 |
wp_enqueue_style( 'charitable-admin-user-onboarding' ); |
| 24 |
|
| 25 |
// Has this user already completed the onboarding process? |
| 26 |
$charitable_onboarding_completed = get_option( 'charitable_ss_complete', false ) ? true : false; |
| 27 |
$charitable_onboarding_welcome = ! empty( $_GET['f'] ) ? intval( $_GET['f'] ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 28 |
|
| 29 |
$charitable_welcome_headline = $charitable_onboarding_completed ? __( 'Welcome back to the Charitable Setup Wizard!', 'charitable' ) : __( 'Welcome to the Charitable Setup Wizard!', 'charitable' ); |
| 30 |
$charitable_introduction_text = $charitable_onboarding_completed ? __( 'You have already completed the setup wizard. If you need to make any changes, you can restart this process or adjust your Charitable settings.', 'charitable' ) : __( 'Your first fundraising begins with a creating a campaign. Ready to get started? Your first campaign is just 5 minutes away!', 'charitable' ); |
| 31 |
$charitable_button_label = $charitable_onboarding_completed ? __( 'Restart Setup Wizard', 'charitable' ) : __( 'Let\'s Get Started', 'charitable' ); |
| 32 |
|
| 33 |
|
| 34 |
// Either they are going "back" to the checklist page or (if the checlist is disabled) the welcome page. |
| 35 |
$charitable_checklist_class = Charitable_Checklist::get_instance(); |
| 36 |
$charitable_checklist_possible = $charitable_checklist_class->maybe_load_checklist_assets(); |
| 37 |
$charitable_welcome_go_back_url = ! $charitable_checklist_possible ? admin_url( 'admin.php?page=charitable-dashboard&charitable_onboarding=cancel' ) : admin_url( 'admin.php?page=charitable-setup-checklist&charitable_onboarding=cancel' ); |
| 38 |
$charitable_welcome_go_back_text = ! $charitable_checklist_possible ? __( 'Go back to the dashboard', 'charitable' ) : __( 'Cancel this wizard and go back to the checklist', 'charitable' ); |
| 39 |
|
| 40 |
// Resume the onboarding process if it has been started, and override text. |
| 41 |
$charitable_resume_onboarding = get_option( 'charitable_started_onboarding', false ); |
| 42 |
if ( $charitable_resume_onboarding && ! $charitable_onboarding_welcome ) { |
| 43 |
$charitable_welcome_headline = __( 'Welcome back to the Charitable Setup Wizard!', 'charitable' ); |
| 44 |
$charitable_introduction_text = __( 'You have already started the setup wizard. Would you like to continue where you left off?', 'charitable' ); |
| 45 |
$charitable_button_label = __( 'Resume Setup Wizard', 'charitable' ); |
| 46 |
$charitable_onboarding_url = add_query_arg( array( 'resume' => 'true' ), charitable_get_onboarding_url() ); |
| 47 |
$charitable_welcome_go_back_url = admin_url( 'admin.php?page=charitable-setup-checklist&charitable_onboarding=cancel' ); |
| 48 |
} |
| 49 |
// The setup wizard finishes by sending your choices back from WPCharitable.com to your site. |
| 50 |
// If that hand-off arrives without its data (which can happen when a site redirects the |
| 51 |
// connection, for example between http and https or www and non-www, or when a security |
| 52 |
// plugin blocks it), we land here. The user reaching this screen is still logged in, so we |
| 53 |
// explain what happened and offer to try again or finish setup manually rather than telling |
| 54 |
// them they are logged out. |
| 55 |
if ( ! empty( $_GET['lostconnection'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 56 |
$charitable_welcome_headline = __( 'Welcome back!', 'charitable' ); |
| 57 |
$charitable_introduction_text = __( 'We were not able to bring your choices back from the setup wizard, so setup did not finish. Your login is fine and nothing is wrong with your install. You can try the wizard again, or skip it and set up Charitable yourself from the dashboard.', 'charitable' ); |
| 58 |
$charitable_button_label = __( 'Try Again', 'charitable' ); |
| 59 |
$charitable_onboarding_url = add_query_arg( array( 'resume' => 'true' ), charitable_get_onboarding_url() ); |
| 60 |
$charitable_welcome_go_back_url = admin_url( 'admin.php?page=charitable-setup-checklist&charitable_onboarding=cancel' ); |
| 61 |
} |
| 62 |
|
| 63 |
?> |
| 64 |
<div class="charitable-user-onboarding-wrap"> |
| 65 |
<div class="charitable-user-onboarding-logo"> |
| 66 |
<img src="<?php echo esc_url( charitable()->get_path( 'assets', false ) . 'images/onboarding/welcome/charitable-header-logo.png' ); ?>" alt="Charitable"> |
| 67 |
</div> |
| 68 |
<div class="chartiable-user-onboarding-content"> |
| 69 |
<h1><?php echo esc_html( $charitable_welcome_headline ); ?></h1> |
| 70 |
<p><?php echo esc_html( $charitable_introduction_text ); ?></p> |
| 71 |
<a href="<?php echo esc_url( $charitable_onboarding_url ); ?>" class="charitable-button-link"><?php echo esc_html( $charitable_button_label ); ?> →</a> |
| 72 |
</div> |
| 73 |
<div class="charitable-go-back"><a href="<?php echo esc_url( $charitable_welcome_go_back_url ); ?>">← <?php echo esc_html( $charitable_welcome_go_back_text ); ?></a></div> |
| 74 |
<div class="charitable-onbarding-notice"> |
| 75 |
<p><?php echo esc_html__( 'Note: You will be transfered to an WPCharitable.com to complete the setup wizard.', 'charitable' ); ?></p> |
| 76 |
</div> |
| 77 |
</div> |
| 78 |
|