PHP 8.2.31
Preview: OnboardingProfile.php Size: 2.00 KB
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/OnboardingProfile.php

<?php
/**
 * WooCommerce Onboarding Setup Wizard
 */

namespace Automattic\WooCommerce\Internal\Admin\Onboarding;

use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskLists;
use Automattic\WooCommerce\Admin\PageController;
use Automattic\WooCommerce\Admin\WCAdminHelper;

/**
 * Contains backend logic for the onboarding profile and checklist feature.
 */
class OnboardingProfile {
	/**
	 * Profile data option name.
	 */
	const DATA_OPTION = 'woocommerce_onboarding_profile';

	/**
	 * Option for storing the onboarding profile progress.
	 */
	const PROGRESS_OPTION = 'woocommerce_onboarding_profile_progress';

	/**
	 * Add onboarding actions.
	 */
	public static function init() {
		add_action( 'update_option_' . self::DATA_OPTION, array( __CLASS__, 'trigger_complete' ), 10, 2 );
	}

	/**
	 * Trigger the woocommerce_onboarding_profile_completed action
	 *
	 * @param array $old_value Previous value.
	 * @param array $value Current value.
	 */
	public static function trigger_complete( $old_value, $value ) {
		if ( isset( $old_value['completed'] ) && $old_value['completed'] ) {
			return;
		}

		if ( ! isset( $value['completed'] ) || ! $value['completed'] ) {
			return;
		}

		/**
		 * Action hook fired when the onboarding profile (or onboarding wizard,
		 * or profiler) is completed.
		 *
		 * @since 1.5.0
		 */
		do_action( 'woocommerce_onboarding_profile_completed' );
	}

	/**
	 * Check if the profiler still needs to be completed.
	 *
	 * @return bool
	 */
	public static function needs_completion() {
		$onboarding_data = get_option( self::DATA_OPTION, array() );

		$is_completed = isset( $onboarding_data['completed'] ) && true === $onboarding_data['completed'];
		$is_skipped   = isset( $onboarding_data['skipped'] ) && true === $onboarding_data['skipped'];

		// @todo When merging to WooCommerce Core, we should set the `completed` flag to true during the upgrade progress.
		// https://github.com/woocommerce/woocommerce-admin/pull/2300#discussion_r287237498.
		return ! $is_completed && ! $is_skipped;
	}
}

Directory Contents

Dirs: 0 × Files: 9

Name Size Perms Modified Actions
610 B lrw-r--r-- 2026-01-19 14:46:18
Edit Download
4.86 KB lrw-r--r-- 2024-11-14 01:17:00
Edit Download
2.89 KB lrw-r--r-- 2024-05-28 14:28:20
Edit Download
1.80 KB lrw-r--r-- 2022-08-24 02:07:06
Edit Download
1.19 KB lrw-r--r-- 2022-08-24 02:07:06
Edit Download
5.34 KB lrw-r--r-- 2023-05-24 03:17:54
Edit Download
2.00 KB lrw-r--r-- 2024-12-18 22:19:16
Edit Download
10.65 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
4.01 KB lrw-r--r-- 2024-04-10 16:54:10
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).