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

  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' ) ) { 
  12. exit; // Exit if accessed directly 
  13.  
  14. if ( ! class_exists( 'WC_Settings_Accounts', false ) ) : 
  15.  
  16. /** 
  17. * WC_Settings_Accounts. 
  18. */ 
  19. class WC_Settings_Accounts extends WC_Settings_Page { 
  20.  
  21. /** 
  22. * Constructor. 
  23. */ 
  24. public function __construct() { 
  25.  
  26. $this->id = 'account'; 
  27. $this->label = __( 'Accounts', 'woocommerce' ); 
  28.  
  29. add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); 
  30. add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) ); 
  31. add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) ); 
  32.  
  33. /** 
  34. * Get settings array. 
  35. * 
  36. * @return array 
  37. */ 
  38. public function get_settings() { 
  39. $settings = 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' => sprintf( __( 'Page contents: [%s]', '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' => 'wc-enhanced-select',  
  50. 'css' => 'min-width:300px;',  
  51. 'desc_tip' => true,  
  52. ),  
  53.  
  54. array( 'type' => 'sectionend', 'id' => 'account_page_options' ),  
  55.  
  56. array( 'title' => '', 'type' => 'title', 'id' => 'account_registration_options' ),  
  57.  
  58. array( 
  59. 'title' => __( 'Customer registration', 'woocommerce' ),  
  60. 'desc' => __( 'Enable customer registration on the "Checkout" page.', 'woocommerce' ),  
  61. 'id' => 'woocommerce_enable_signup_and_login_from_checkout',  
  62. 'default' => 'yes',  
  63. 'type' => 'checkbox',  
  64. 'checkboxgroup' => 'start',  
  65. 'autoload' => false,  
  66. ),  
  67.  
  68. array( 
  69. 'desc' => __( 'Enable customer registration on the "My account" page.', 'woocommerce' ),  
  70. 'id' => 'woocommerce_enable_myaccount_registration',  
  71. 'default' => 'no',  
  72. 'type' => 'checkbox',  
  73. 'checkboxgroup' => 'end',  
  74. 'autoload' => false,  
  75. ),  
  76.  
  77. array( 
  78. 'title' => __( 'Login', 'woocommerce' ),  
  79. 'desc' => __( 'Display returning customer login reminder on the "Checkout" page.', 'woocommerce' ),  
  80. 'id' => 'woocommerce_enable_checkout_login_reminder',  
  81. 'default' => 'yes',  
  82. 'type' => 'checkbox',  
  83. 'checkboxgroup' => 'start',  
  84. 'autoload' => false,  
  85. ),  
  86.  
  87. array( 
  88. 'title' => __( 'Account creation', 'woocommerce' ),  
  89. 'desc' => __( 'Automatically generate username from customer email.', 'woocommerce' ),  
  90. 'id' => 'woocommerce_registration_generate_username',  
  91. 'default' => 'yes',  
  92. 'type' => 'checkbox',  
  93. 'checkboxgroup' => 'start',  
  94. 'autoload' => false,  
  95. ),  
  96.  
  97. array( 
  98. 'desc' => __( 'Automatically generate customer password', 'woocommerce' ),  
  99. 'id' => 'woocommerce_registration_generate_password',  
  100. 'default' => 'no',  
  101. 'type' => 'checkbox',  
  102. 'checkboxgroup' => 'end',  
  103. 'autoload' => false,  
  104. ),  
  105.  
  106. array( 'type' => 'sectionend', 'id' => 'account_registration_options' ),  
  107.  
  108. 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' ),  
  109.  
  110. array( 
  111. 'title' => __( 'Orders', 'woocommerce' ),  
  112. 'desc' => __( 'Endpoint for the "My account → Orders" page.', 'woocommerce' ),  
  113. 'id' => 'woocommerce_myaccount_orders_endpoint',  
  114. 'type' => 'text',  
  115. 'default' => 'orders',  
  116. 'desc_tip' => true,  
  117. ),  
  118.  
  119. array( 
  120. 'title' => __( 'View order', 'woocommerce' ),  
  121. 'desc' => __( 'Endpoint for the "My account → View order" page.', 'woocommerce' ),  
  122. 'id' => 'woocommerce_myaccount_view_order_endpoint',  
  123. 'type' => 'text',  
  124. 'default' => 'view-order',  
  125. 'desc_tip' => true,  
  126. ),  
  127.  
  128. array( 
  129. 'title' => __( 'Downloads', 'woocommerce' ),  
  130. 'desc' => __( 'Endpoint for the "My account → Downloads" page.', 'woocommerce' ),  
  131. 'id' => 'woocommerce_myaccount_downloads_endpoint',  
  132. 'type' => 'text',  
  133. 'default' => 'downloads',  
  134. 'desc_tip' => true,  
  135. ),  
  136.  
  137. array( 
  138. 'title' => __( 'Edit account', 'woocommerce' ),  
  139. 'desc' => __( 'Endpoint for the "My account → Edit account" page.', 'woocommerce' ),  
  140. 'id' => 'woocommerce_myaccount_edit_account_endpoint',  
  141. 'type' => 'text',  
  142. 'default' => 'edit-account',  
  143. 'desc_tip' => true,  
  144. ),  
  145.  
  146. array( 
  147. 'title' => __( 'Addresses', 'woocommerce' ),  
  148. 'desc' => __( 'Endpoint for the "My account → Addresses" page.', 'woocommerce' ),  
  149. 'id' => 'woocommerce_myaccount_edit_address_endpoint',  
  150. 'type' => 'text',  
  151. 'default' => 'edit-address',  
  152. 'desc_tip' => true,  
  153. ),  
  154.  
  155. array( 
  156. 'title' => __( 'Payment methods', 'woocommerce' ),  
  157. 'desc' => __( 'Endpoint for the "My account → Payment methods" page.', 'woocommerce' ),  
  158. 'id' => 'woocommerce_myaccount_payment_methods_endpoint',  
  159. 'type' => 'text',  
  160. 'default' => 'payment-methods',  
  161. 'desc_tip' => true,  
  162. ),  
  163.  
  164. array( 
  165. 'title' => __( 'Lost password', 'woocommerce' ),  
  166. 'desc' => __( 'Endpoint for the "My account → Lost password" page.', 'woocommerce' ),  
  167. 'id' => 'woocommerce_myaccount_lost_password_endpoint',  
  168. 'type' => 'text',  
  169. 'default' => 'lost-password',  
  170. 'desc_tip' => true,  
  171. ),  
  172.  
  173. array( 
  174. 'title' => __( 'Logout', 'woocommerce' ),  
  175. 'desc' => __( 'Endpoint for the triggering logout. You can add this to your menus via a custom link: yoursite.com/?customer-logout=true', 'woocommerce' ),  
  176. 'id' => 'woocommerce_logout_endpoint',  
  177. 'type' => 'text',  
  178. 'default' => 'customer-logout',  
  179. 'desc_tip' => true,  
  180. ),  
  181.  
  182. array( 'type' => 'sectionend', 'id' => 'account_endpoint_options' ),  
  183.  
  184. ) ); 
  185.  
  186. return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings ); 
  187.  
  188. endif; 
  189.  
  190. return new WC_Settings_Accounts(); 
.