2013-08-22 10:58:03 +00:00
< ? php
/**
2015-11-03 13:53:50 +00:00
* WooCommerce Account Settings
2013-08-22 10:58:03 +00:00
*
2014-08-31 08:22:03 +00:00
* @ author WooThemes
* @ category Admin
* @ package WooCommerce / Admin
2013-08-22 10:58:03 +00:00
* @ version 2.1 . 0
*/
2014-09-20 19:55:47 +00:00
if ( ! defined ( 'ABSPATH' ) ) {
exit ; // Exit if accessed directly
}
2013-08-22 10:58:03 +00:00
if ( ! class_exists ( 'WC_Settings_Accounts' ) ) :
/**
2015-11-03 13:31:20 +00:00
* WC_Settings_Accounts .
2013-08-22 10:58:03 +00:00
*/
class WC_Settings_Accounts extends WC_Settings_Page {
/**
* Constructor .
*/
public function __construct () {
2014-08-31 08:22:03 +00:00
2013-08-22 10:58:03 +00:00
$this -> id = 'account' ;
$this -> label = __ ( 'Accounts' , 'woocommerce' );
add_filter ( 'woocommerce_settings_tabs_array' , array ( $this , 'add_settings_page' ), 20 );
add_action ( 'woocommerce_settings_' . $this -> id , array ( $this , 'output' ) );
add_action ( 'woocommerce_settings_save_' . $this -> id , array ( $this , 'save' ) );
}
/**
2015-11-03 13:31:20 +00:00
* Get settings array .
2013-08-22 10:58:03 +00:00
*
* @ return array
*/
public function get_settings () {
2014-09-12 11:20:06 +00:00
$settings = apply_filters ( 'woocommerce_' . $this -> id . '_settings' , array (
2013-08-22 10:58:03 +00:00
2013-08-22 11:11:19 +00:00
array ( 'title' => __ ( 'Account Pages' , 'woocommerce' ), 'type' => 'title' , 'desc' => __ ( 'These pages need to be set so that WooCommerce knows where to send users to access account related functionality.' , 'woocommerce' ), 'id' => 'account_page_options' ),
2013-08-22 10:58:03 +00:00
array (
2014-08-31 08:22:03 +00:00
'title' => __ ( 'My Account Page' , 'woocommerce' ),
'desc' => __ ( 'Page contents:' , 'woocommerce' ) . ' [' . apply_filters ( 'woocommerce_my_account_shortcode_tag' , 'woocommerce_my_account' ) . ']' ,
'id' => 'woocommerce_myaccount_page_id' ,
'type' => 'single_select_page' ,
'default' => '' ,
2015-01-12 16:29:01 +00:00
'class' => 'wc-enhanced-select' ,
2014-08-31 08:22:03 +00:00
'css' => 'min-width:300px;' ,
'desc_tip' => true ,
2013-08-22 10:58:03 +00:00
),
array ( 'type' => 'sectionend' , 'id' => 'account_page_options' ),
2016-04-22 11:29:06 +00:00
array ( 'title' => '' , 'type' => 'title' , 'id' => 'account_registration_options' ),
array (
'title' => __ ( 'Enable Registration' , 'woocommerce' ),
'desc' => __ ( 'Enable registration on the "Checkout" page' , 'woocommerce' ),
'id' => 'woocommerce_enable_signup_and_login_from_checkout' ,
'default' => 'yes' ,
'type' => 'checkbox' ,
'checkboxgroup' => 'start' ,
2016-08-27 01:46:45 +00:00
'autoload' => false ,
2016-04-22 11:29:06 +00:00
),
array (
'desc' => __ ( 'Enable registration on the "My Account" page' , 'woocommerce' ),
'id' => 'woocommerce_enable_myaccount_registration' ,
'default' => 'no' ,
'type' => 'checkbox' ,
'checkboxgroup' => 'end' ,
2016-08-27 01:46:45 +00:00
'autoload' => false ,
2016-04-22 11:29:06 +00:00
),
array (
'title' => __ ( 'Login' , 'woocommerce' ),
'desc' => __ ( 'Display returning customer login reminder on the "Checkout" page' , 'woocommerce' ),
'id' => 'woocommerce_enable_checkout_login_reminder' ,
'default' => 'yes' ,
'type' => 'checkbox' ,
'checkboxgroup' => 'start' ,
2016-08-27 01:46:45 +00:00
'autoload' => false ,
2016-04-22 11:29:06 +00:00
),
array (
'title' => __ ( 'Account Creation' , 'woocommerce' ),
'desc' => __ ( 'Automatically generate username from customer email' , 'woocommerce' ),
'id' => 'woocommerce_registration_generate_username' ,
'default' => 'yes' ,
'type' => 'checkbox' ,
'checkboxgroup' => 'start' ,
2016-08-27 01:46:45 +00:00
'autoload' => false ,
2016-04-22 11:29:06 +00:00
),
array (
'desc' => __ ( 'Automatically generate customer password' , 'woocommerce' ),
'id' => 'woocommerce_registration_generate_password' ,
'default' => 'no' ,
'type' => 'checkbox' ,
'checkboxgroup' => 'end' ,
2016-08-27 01:46:45 +00:00
'autoload' => false ,
2016-04-22 11:29:06 +00:00
),
2016-06-30 16:58:10 +00:00
array ( 'type' => 'sectionend' , 'id' => 'account_registration_options' ),
2016-04-22 11:29:06 +00:00
2016-06-30 16:58:10 +00:00
array ( 'title' => __ ( 'My Account Endpoints' , 'woocommerce' ), 'type' => 'title' , 'desc' => __ ( 'Endpoints are appended to your page URLs to handle specific actions on the accounts pages. They should be unique and can be left blank to disable the endpoint.' , 'woocommerce' ), 'id' => 'account_endpoint_options' ),
2013-08-22 10:58:03 +00:00
2016-01-19 19:47:01 +00:00
array (
'title' => __ ( 'Orders' , 'woocommerce' ),
2016-07-26 13:46:50 +00:00
'desc' => sprintf ( __ ( 'Endpoint for the My Account → %s page' , 'woocommerce' ), __ ( 'Orders' , 'woocommerce' ) ),
2016-01-19 19:47:01 +00:00
'id' => 'woocommerce_myaccount_orders_endpoint' ,
'type' => 'text' ,
'default' => 'orders' ,
'desc_tip' => true ,
),
2013-08-22 10:58:03 +00:00
array (
2014-08-31 08:22:03 +00:00
'title' => __ ( 'View Order' , 'woocommerce' ),
2016-07-26 13:46:50 +00:00
'desc' => sprintf ( __ ( 'Endpoint for the My Account → %s page' , 'woocommerce' ), __ ( 'View Order' , 'woocommerce' ) ),
2014-08-31 08:22:03 +00:00
'id' => 'woocommerce_myaccount_view_order_endpoint' ,
'type' => 'text' ,
'default' => 'view-order' ,
'desc_tip' => true ,
2013-08-22 10:58:03 +00:00
),
2016-01-19 19:47:01 +00:00
array (
'title' => __ ( 'Downloads' , 'woocommerce' ),
2016-07-26 13:46:50 +00:00
'desc' => sprintf ( __ ( 'Endpoint for the My Account → %s page' , 'woocommerce' ), __ ( 'Downloads' , 'woocommerce' ) ),
2016-01-19 19:47:01 +00:00
'id' => 'woocommerce_myaccount_downloads_endpoint' ,
'type' => 'text' ,
'default' => 'downloads' ,
'desc_tip' => true ,
),
2013-08-22 10:58:03 +00:00
array (
2014-08-31 08:22:03 +00:00
'title' => __ ( 'Edit Account' , 'woocommerce' ),
2016-07-26 13:46:50 +00:00
'desc' => sprintf ( __ ( 'Endpoint for the My Account → %s page' , 'woocommerce' ), __ ( 'Edit Account' , 'woocommerce' ) ),
2014-08-31 08:22:03 +00:00
'id' => 'woocommerce_myaccount_edit_account_endpoint' ,
'type' => 'text' ,
'default' => 'edit-account' ,
'desc_tip' => true ,
2013-08-22 10:58:03 +00:00
),
array (
2016-05-24 18:09:07 +00:00
'title' => __ ( 'Addresses' , 'woocommerce' ),
2016-07-26 13:46:50 +00:00
'desc' => sprintf ( __ ( 'Endpoint for the My Account → %s page' , 'woocommerce' ), __ ( 'Addresses' , 'woocommerce' ) ),
2014-08-31 08:22:03 +00:00
'id' => 'woocommerce_myaccount_edit_address_endpoint' ,
'type' => 'text' ,
'default' => 'edit-address' ,
'desc_tip' => true ,
2013-08-22 10:58:03 +00:00
),
2016-01-20 20:13:17 +00:00
array (
'title' => __ ( 'Payment Methods' , 'woocommerce' ),
2016-07-26 14:13:09 +00:00
'desc' => sprintf ( __ ( 'Endpoint for the My Account → %s page' , 'woocommerce' ), __ ( 'Payment Methods' , 'woocommerce' ) ),
2016-01-20 20:13:17 +00:00
'id' => 'woocommerce_myaccount_payment_methods_endpoint' ,
'type' => 'text' ,
'default' => 'payment-methods' ,
'desc_tip' => true ,
),
2013-08-22 10:58:03 +00:00
array (
2014-08-31 08:22:03 +00:00
'title' => __ ( 'Lost Password' , 'woocommerce' ),
2016-07-26 13:46:50 +00:00
'desc' => sprintf ( __ ( 'Endpoint for the My Account → %s page' , 'woocommerce' ), __ ( 'Lost Password' , 'woocommerce' ) ),
2014-08-31 08:22:03 +00:00
'id' => 'woocommerce_myaccount_lost_password_endpoint' ,
'type' => 'text' ,
'default' => 'lost-password' ,
'desc_tip' => true ,
2013-08-22 10:58:03 +00:00
),
2013-08-23 15:41:02 +00:00
array (
'title' => __ ( 'Logout' , 'woocommerce' ),
2014-08-31 08:22:03 +00:00
'desc' => __ ( 'Endpoint for the triggering logout. You can add this to your menus via a custom link: yoursite.com/?customer-logout=true' , 'woocommerce' ),
'id' => 'woocommerce_logout_endpoint' ,
'type' => 'text' ,
'default' => 'customer-logout' ,
'desc_tip' => true ,
2013-08-23 15:41:02 +00:00
),
2013-08-22 10:58:03 +00:00
array ( 'type' => 'sectionend' , 'id' => 'account_endpoint_options' ),
2014-09-12 11:20:06 +00:00
) );
return apply_filters ( 'woocommerce_get_settings_' . $this -> id , $settings );
2013-08-22 10:58:03 +00:00
}
}
endif ;
2014-08-31 08:22:03 +00:00
return new WC_Settings_Accounts ();