1 <?php
  2 /**
  3  * WooCommerce Account Settings
  4  *
  5  * @author      WooThemes
  6  * @category    Admin
  7  * @package     WooCommerce/Admin
  8  * @version     2.1.0
  9  */
 10 
 11 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
 12 
 13 if ( ! class_exists( 'WC_Settings_Accounts' ) ) :
 14 
 15 /**
 16  * WC_Settings_Accounts
 17  */
 18 class WC_Settings_Accounts extends WC_Settings_Page {
 19 
 20     /**
 21      * Constructor.
 22      */
 23     public function __construct() {
 24         $this->id    = 'account';
 25         $this->label = __( 'Accounts', 'woocommerce' );
 26 
 27         add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
 28         add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) );
 29         add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) );
 30     }
 31 
 32     /**
 33      * Get settings array
 34      *
 35      * @return array
 36      */
 37     public function get_settings() {
 38 
 39         return apply_filters( 'woocommerce_' . $this->id . '_settings', array(
 40 
 41             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' ),
 42 
 43             array(
 44                 'title' => __( 'My Account Page', 'woocommerce' ),
 45                 'desc'      => __( 'Page contents:', 'woocommerce' ) . ' [' . apply_filters( 'woocommerce_my_account_shortcode_tag', 'woocommerce_my_account' ) . ']',
 46                 'id'        => 'woocommerce_myaccount_page_id',
 47                 'type'      => 'single_select_page',
 48                 'default'   => '',
 49                 'class'     => 'chosen_select_nostd',
 50                 'css'       => 'min-width:300px;',
 51                 'desc_tip'  => true,
 52             ),
 53 
 54             array( 'type' => 'sectionend', 'id' => 'account_page_options' ),
 55 
 56             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.', 'woocommerce' ), 'id' => 'account_endpoint_options' ),
 57 
 58             array(
 59                 'title' => __( 'View Order', 'woocommerce' ),
 60                 'desc'      => __( 'Endpoint for the My Account &rarr; View Order page', 'woocommerce' ),
 61                 'id'        => 'woocommerce_myaccount_view_order_endpoint',
 62                 'type'      => 'text',
 63                 'default'   => 'view-order',
 64                 'desc_tip'  => true,
 65             ),
 66 
 67             array(
 68                 'title' => __( 'Edit Account', 'woocommerce' ),
 69                 'desc'      => __( 'Endpoint for the My Account &rarr; Edit Account page', 'woocommerce' ),
 70                 'id'        => 'woocommerce_myaccount_edit_account_endpoint',
 71                 'type'      => 'text',
 72                 'default'   => 'edit-account',
 73                 'desc_tip'  => true,
 74             ),
 75 
 76             array(
 77                 'title' => __( 'Edit Address', 'woocommerce' ),
 78                 'desc'      => __( 'Endpoint for the My Account &rarr; Edit Address page', 'woocommerce' ),
 79                 'id'        => 'woocommerce_myaccount_edit_address_endpoint',
 80                 'type'      => 'text',
 81                 'default'   => 'edit-address',
 82                 'desc_tip'  => true,
 83             ),
 84 
 85             array(
 86                 'title' => __( 'Lost Password', 'woocommerce' ),
 87                 'desc'      => __( 'Endpoint for the My Account &rarr; Lost Password page', 'woocommerce' ),
 88                 'id'        => 'woocommerce_myaccount_lost_password_endpoint',
 89                 'type'      => 'text',
 90                 'default'   => 'lost-password',
 91                 'desc_tip'  => true,
 92             ),
 93 
 94             array(
 95                 'title' => __( 'Logout', 'woocommerce' ),
 96                 'desc'      => __( 'Endpoint for the triggering logout. You can add this to your menus via a custom link: yoursite.com/?customer-logout=true', 'woocommerce' ),
 97                 'id'        => 'woocommerce_logout_endpoint',
 98                 'type'      => 'text',
 99                 'default'   => 'customer-logout',
100                 'desc_tip'  => true,
101             ),
102 
103             array( 'type' => 'sectionend', 'id' => 'account_endpoint_options' ),
104 
105             array(  'title' => __( 'Registration Options', 'woocommerce' ), 'type' => 'title', 'id' => 'account_registration_options' ),
106 
107             array(
108                 'title'         => __( 'Enable Registration', 'woocommerce' ),
109                 'desc'          => __( 'Enable registration on the "Checkout" page', 'woocommerce' ),
110                 'id'            => 'woocommerce_enable_signup_and_login_from_checkout',
111                 'default'       => 'yes',
112                 'type'          => 'checkbox',
113                 'checkboxgroup' => 'start',
114                 'autoload'      => false
115             ),
116 
117             array(
118                 'desc'          => __( 'Enable registration on the "My Account" page', 'woocommerce' ),
119                 'id'            => 'woocommerce_enable_myaccount_registration',
120                 'default'       => 'no',
121                 'type'          => 'checkbox',
122                 'checkboxgroup' => 'end',
123                 'autoload'      => false
124             ),
125 
126             array(
127                 'desc'          => __( 'Display returning customer login reminder on the "Checkout" page', 'woocommerce' ),
128                 'id'            => 'woocommerce_enable_checkout_login_reminder',
129                 'default'       => 'yes',
130                 'type'          => 'checkbox',
131                 'checkboxgroup' => 'start',
132                 'autoload'      => false
133             ),
134 
135             array(
136                 'title'         => __( 'Account Creation', 'woocommerce' ),
137                 'desc'          => __( 'Automatically generate username from customer email', 'woocommerce' ),
138                 'id'            => 'woocommerce_registration_generate_username',
139                 'default'       => 'yes',
140                 'type'          => 'checkbox',
141                 'checkboxgroup' => 'start',
142                 'autoload'      => false
143             ),
144 
145             array(
146                 'desc'          => __( 'Automatically generate customer password', 'woocommerce' ),
147                 'id'            => 'woocommerce_registration_generate_password',
148                 'default'       => 'no',
149                 'type'          => 'checkbox',
150                 'checkboxgroup' => 'end',
151                 'autoload'      => false
152             ),
153 
154             array( 'type' => 'sectionend', 'id' => 'account_registration_options'),
155 
156         )); // End pages settings
157     }
158 }
159 
160 endif;
161 
162 return new WC_Settings_Accounts();
WooCommerce API documentation generated by ApiGen 2.8.0