woocommerce/includes/admin/settings/class-wc-settings-accounts.php

232 lines
9.4 KiB
PHP
Raw Normal View History

<?php
/**
2018-04-12 10:13:01 +00:00
* WooCommerce Account Settings.
*
2018-04-12 10:13:01 +00:00
* @package WooCommerce/Admin
*/
2018-04-12 10:13:01 +00:00
defined( 'ABSPATH' ) || exit;
if ( class_exists( 'WC_Settings_Accounts', false ) ) {
return new WC_Settings_Accounts();
}
/**
* WC_Settings_Accounts.
*/
class WC_Settings_Accounts extends WC_Settings_Page {
/**
* Constructor.
*/
public function __construct() {
$this->id = 'account';
$this->label = __( 'Accounts &amp; Privacy', 'woocommerce' );
parent::__construct();
}
/**
* Get settings array.
*
* @return array
*/
public function get_settings() {
$erasure_text = esc_html__( 'account erasure request', 'woocommerce' );
if ( current_user_can( 'manage_privacy_options' ) ) {
$erasure_text = sprintf( '<a href="%s">%s</a>', esc_url( admin_url( 'tools.php?page=remove_personal_data' ) ), $erasure_text );
}
$settings = apply_filters(
'woocommerce_' . $this->id . '_settings', array(
array(
'title' => '',
'type' => 'title',
'id' => 'account_registration_options',
),
array(
'title' => __( 'Guest checkout', 'woocommerce' ),
2018-05-21 16:02:33 +00:00
'desc' => __( 'Allow customers to place orders without an account', 'woocommerce' ),
'id' => 'woocommerce_enable_guest_checkout',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'autoload' => false,
),
array(
'title' => __( 'Login', 'woocommerce' ),
'desc' => __( 'Allow customers to log into an existing account during checkout', 'woocommerce' ),
'id' => 'woocommerce_enable_checkout_login_reminder',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
'autoload' => false,
),
array(
'title' => __( 'Account creation', 'woocommerce' ),
2018-05-21 16:02:33 +00:00
'desc' => __( 'Allow customers to create an account during checkout', 'woocommerce' ),
'id' => 'woocommerce_enable_signup_and_login_from_checkout',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'start',
'autoload' => false,
),
array(
2018-05-21 16:02:33 +00:00
'desc' => __( 'Allow customers to create an account on the "My account" page', 'woocommerce' ),
'id' => 'woocommerce_enable_myaccount_registration',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => '',
'autoload' => false,
),
array(
2018-05-21 16:02:33 +00:00
'desc' => __( 'When creating an account, automatically generate a username from the customer\'s email address', 'woocommerce' ),
'id' => 'woocommerce_registration_generate_username',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => '',
'autoload' => false,
),
array(
2018-05-21 16:02:33 +00:00
'desc' => __( 'When creating an account, automatically generate an account password', 'woocommerce' ),
'id' => 'woocommerce_registration_generate_password',
'default' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'end',
'autoload' => false,
),
2018-04-30 14:38:45 +00:00
array(
'title' => __( 'Account erasure requests', 'woocommerce' ),
'desc' => __( 'Remove personal data from orders', 'woocommerce' ),
2018-04-30 14:41:38 +00:00
/* Translators: %s URL to erasure request screen. */
'desc_tip' => sprintf( esc_html__( 'When handling an %s, should personal data within orders be retained or removed?', 'woocommerce' ), $erasure_text ),
2018-04-30 14:38:45 +00:00
'id' => 'woocommerce_erasure_request_removes_order_data',
'type' => 'checkbox',
'default' => 'no',
'checkboxgroup' => 'start',
'autoload' => false,
),
array(
'desc' => __( 'Remove access to downloads', 'woocommerce' ),
2018-04-30 14:41:38 +00:00
/* Translators: %s URL to erasure request screen. */
'desc_tip' => sprintf( esc_html__( 'When handling an %s, should access to downloadable files be revoked and download logs cleared?', 'woocommerce' ), $erasure_text ),
2018-04-30 14:38:45 +00:00
'id' => 'woocommerce_erasure_request_removes_download_data',
'type' => 'checkbox',
'default' => 'no',
'checkboxgroup' => 'end',
'autoload' => false,
),
array(
'type' => 'sectionend',
'id' => 'account_registration_options',
),
2018-04-17 17:32:31 +00:00
array(
'title' => __( 'Privacy policy', 'woocommerce' ),
'type' => 'title',
'id' => 'privacy_policy_options',
'desc' => __( 'This section controls the display of your website privacy policy. The privacy notices below will not show up unless a privacy page is first set.', 'woocommerce' ),
),
array(
'title' => __( 'Privacy page', 'woocommerce' ),
'desc' => __( 'Choose a page to act as your privacy policy.', 'woocommerce' ),
'id' => 'wp_page_for_privacy_policy',
'type' => 'single_select_page',
'default' => '',
'class' => 'wc-enhanced-select-nostd',
'css' => 'min-width:300px;',
'desc_tip' => true,
),
array(
'title' => __( 'Registration privacy policy', 'woocommerce' ),
'desc_tip' => __( 'Optionally add some text about your store privacy policy to show on account registration forms.', 'woocommerce' ),
'id' => 'woocommerce_registration_privacy_policy_text',
/* translators: %s privacy policy page name and link */
'default' => sprintf( __( 'Your personal data will be used to support your experience throughout this website, to manage access to your account, and for other purposes described in our %s.', 'woocommerce' ), '[privacy_policy]' ),
2018-04-17 17:32:31 +00:00
'type' => 'textarea',
'css' => 'min-width: 50%; height: 75px;',
),
array(
'title' => __( 'Checkout privacy policy', 'woocommerce' ),
'desc_tip' => __( 'Optionally add some text about your store privacy policy to show during checkout.', 'woocommerce' ),
'id' => 'woocommerce_checkout_privacy_policy_text',
/* translators: %s privacy policy page name and link */
'default' => sprintf( __( 'Your personal data will be used to process your order, support your experience throughout this website, and for other purposes described in our %s.', 'woocommerce' ), '[privacy_policy]' ),
2018-04-17 17:32:31 +00:00
'type' => 'textarea',
'css' => 'min-width: 50%; height: 75px;',
),
array(
'type' => 'sectionend',
'id' => 'privacy_policy_options',
),
2018-04-17 10:45:24 +00:00
array(
2018-04-30 14:38:45 +00:00
'title' => __( 'Personal data retention', 'woocommerce' ),
2018-05-04 14:57:01 +00:00
'desc' => __( 'Choose how long to retain personal data when it\'s no longer needed for processing. Leave the following options blank to retain this data indefinitely.', 'woocommerce' ),
2018-04-17 10:45:24 +00:00
'type' => 'title',
2018-04-30 14:38:45 +00:00
'id' => 'personal_data_retention',
),
array(
2018-04-30 14:38:45 +00:00
'title' => __( 'Retain inactive accounts ', 'woocommerce' ),
'desc_tip' => __( 'Inactive accounts are those which have not logged in, or placed an order, for the specified duration. They will be deleted. Any orders will be converted into guest orders.', 'woocommerce' ),
'id' => 'woocommerce_delete_inactive_accounts',
'type' => 'relative_date_selector',
'placeholder' => __( 'N/A', 'woocommerce' ),
'default' => array(
'number' => '',
'unit' => 'months',
),
'autoload' => false,
2018-04-17 10:45:24 +00:00
),
array(
2018-04-24 15:47:55 +00:00
'title' => __( 'Retain pending orders ', 'woocommerce' ),
2018-05-01 12:54:18 +00:00
'desc_tip' => __( 'Pending orders are unpaid and may have been abandoned by the customer. They will be trashed after the specified duration.', 'woocommerce' ),
2018-04-17 10:45:24 +00:00
'id' => 'woocommerce_trash_pending_orders',
2018-04-17 14:21:03 +00:00
'type' => 'relative_date_selector',
2018-04-17 10:45:24 +00:00
'placeholder' => __( 'N/A', 'woocommerce' ),
2018-04-18 10:24:07 +00:00
'default' => '',
2018-04-17 10:45:24 +00:00
'autoload' => false,
),
array(
2018-04-24 15:47:55 +00:00
'title' => __( 'Retain failed orders', 'woocommerce' ),
2018-05-01 12:54:18 +00:00
'desc_tip' => __( 'Failed orders are unpaid and may have been abandoned by the customer. They will be trashed after the specified duration.', 'woocommerce' ),
2018-04-17 10:45:24 +00:00
'id' => 'woocommerce_trash_failed_orders',
2018-04-17 14:21:03 +00:00
'type' => 'relative_date_selector',
2018-04-17 10:45:24 +00:00
'placeholder' => __( 'N/A', 'woocommerce' ),
2018-04-18 10:24:07 +00:00
'default' => '',
2018-04-17 10:45:24 +00:00
'autoload' => false,
),
array(
2018-04-24 15:47:55 +00:00
'title' => __( 'Retain cancelled orders', 'woocommerce' ),
2018-04-30 14:38:45 +00:00
'desc_tip' => __( 'Cancelled orders are unpaid and may have been cancelled by the store owner or customer. They will be trashed after the specified duration.', 'woocommerce' ),
2018-04-17 10:45:24 +00:00
'id' => 'woocommerce_trash_cancelled_orders',
2018-04-17 14:21:03 +00:00
'type' => 'relative_date_selector',
2018-04-17 10:45:24 +00:00
'placeholder' => __( 'N/A', 'woocommerce' ),
2018-04-18 10:24:07 +00:00
'default' => '',
2018-04-17 10:45:24 +00:00
'autoload' => false,
),
array(
2018-04-24 15:47:55 +00:00
'title' => __( 'Retain completed orders', 'woocommerce' ),
2018-04-30 14:38:45 +00:00
'desc_tip' => __( 'Retain completed orders for a specified duration before anonymizing the personal data within them.', 'woocommerce' ),
2018-04-17 14:21:03 +00:00
'id' => 'woocommerce_anonymize_completed_orders',
'type' => 'relative_date_selector',
2018-04-17 10:45:24 +00:00
'placeholder' => __( 'N/A', 'woocommerce' ),
2018-04-24 15:47:55 +00:00
'default' => array(
'number' => '',
2018-04-30 14:38:45 +00:00
'unit' => 'months',
2018-04-24 15:47:55 +00:00
),
2018-04-17 10:45:24 +00:00
'autoload' => false,
),
array(
'type' => 'sectionend',
2018-04-30 14:38:45 +00:00
'id' => 'personal_data_retention',
2018-04-17 10:45:24 +00:00
),
)
);
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
}
}
return new WC_Settings_Accounts();