WC_Admin_Help

WC_Admin_Help Class.

Defined (1)

The class is defined in the following location(s).

/includes/admin/class-wc-admin-help.php  
  1. class WC_Admin_Help { 
  2.  
  3. /** 
  4. * Hook in tabs. 
  5. */ 
  6. public function __construct() { 
  7. add_action( "current_screen", array( $this, 'add_tabs' ), 50 ); 
  8.  
  9. /** 
  10. * Add Contextual help tabs. 
  11. */ 
  12. public function add_tabs() { 
  13. $screen = get_current_screen(); 
  14.  
  15. if ( ! $screen || ! in_array( $screen->id, wc_get_screen_ids() ) ) { 
  16. return; 
  17.  
  18. $video_map = array( 
  19. 'wc-settings' => array( 
  20. 'title' => __( 'General Settings', 'woocommerce' ),  
  21. 'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true' 
  22. ),  
  23. 'wc-settings-general' => array( 
  24. 'title' => __( 'General Settings', 'woocommerce' ),  
  25. 'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true' 
  26. ),  
  27. 'wc-settings-products' => array( 
  28. 'title' => __( 'Product Settings', 'woocommerce' ),  
  29. 'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf?videoFoam=true' 
  30. ),  
  31. 'wc-settings-tax' => array( 
  32. 'title' => __( 'Tax Settings', 'woocommerce' ),  
  33. 'url' => '//fast.wistia.net/embed/iframe/qp1v19dwrh?videoFoam=true' 
  34. ),  
  35. 'wc-settings-shipping' => array( 
  36. 'title' => __( 'Shipping Zones', 'woocommerce' ),  
  37. 'url' => '//fast.wistia.net/embed/iframe/95yiocro6p?videoFoam=true' 
  38. ),  
  39. 'wc-settings-shipping-options' => array( 
  40. 'title' => __( 'Shipping Options', 'woocommerce' ),  
  41. 'url' => '//fast.wistia.net/embed/iframe/9c9008dxnr?videoFoam=true' 
  42. ),  
  43. 'wc-settings-shipping-classes' => array( 
  44. 'title' => __( 'Shipping Classes', 'woocommerce' ),  
  45. 'url' => '//fast.wistia.net/embed/iframe/tpqg17aq99?videoFoam=true' 
  46. ),  
  47. 'wc-settings-checkout' => array( 
  48. 'title' => __( 'Checkout Settings', 'woocommerce' ),  
  49. 'url' => '//fast.wistia.net/embed/iframe/65yjv96z51?videoFoam=true' 
  50. ),  
  51. 'wc-settings-checkout-bacs' => array( 
  52. 'title' => __( 'Bank Transfer (BACS) Payments', 'woocommerce' ),  
  53. 'url' => '//fast.wistia.net/embed/iframe/dh4piy3sek?videoFoam=true' 
  54. ),  
  55. 'wc-settings-checkout-cheque' => array( 
  56. 'title' => __( 'Check Payments', 'woocommerce' ),  
  57. 'url' => '//fast.wistia.net/embed/iframe/u2m2kcakea?videoFoam=true' 
  58. ),  
  59. 'wc-settings-checkout-cod' => array( 
  60. 'title' => __( 'Cash on Delivery', 'woocommerce' ),  
  61. 'url' => '//fast.wistia.net/embed/iframe/8hyli8wu5f?videoFoam=true' 
  62. ),  
  63. 'wc-settings-checkout-paypal' => array( 
  64. 'title' => __( 'PayPal Standard', 'woocommerce' ),  
  65. 'url' => '//fast.wistia.net/embed/iframe/rbl7e7l4k2?videoFoam=true' 
  66. ),  
  67. 'wc-settings-checkout-paypalbraintree_cards' => array( 
  68. 'title' => __( 'PayPal by Braintree', 'woocommerce' ),  
  69. 'url' => '//fast.wistia.net/embed/iframe/oyksirgn40?videoFoam=true' 
  70. ),  
  71. 'wc-settings-checkout-stripe' => array( 
  72. 'title' => __( 'Stripe', 'woocommerce' ),  
  73. 'url' => '//fast.wistia.net/embed/iframe/mf975hx5de?videoFoam=true' 
  74. ),  
  75. 'wc-settings-checkout-simplify_commerce' => array( 
  76. 'title' => __( 'Simplify Commerce', 'woocommerce' ),  
  77. 'url' => '//fast.wistia.net/embed/iframe/jdfzjiiw61?videoFoam=true' 
  78. ),  
  79. 'wc-settings-account' => array( 
  80. 'title' => __( 'Account Settings', 'woocommerce' ),  
  81. 'url' => '//fast.wistia.net/embed/iframe/35mazq7il2?videoFoam=true' 
  82. ),  
  83. 'wc-settings-email' => array( 
  84. 'title' => __( 'Email Settings', 'woocommerce' ),  
  85. 'url' => '//fast.wistia.net/embed/iframe/svcaftq4xv?videoFoam=true' 
  86. ),  
  87. 'wc-settings-api' => array( 
  88. 'title' => __( 'Webhook Settings', 'woocommerce' ),  
  89. 'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq?videoFoam=true' 
  90. ),  
  91. 'product' => array( 
  92. 'title' => __( 'Simple Products', 'woocommerce' ),  
  93. 'url' => '//fast.wistia.net/embed/iframe/ziyjmd4kut?videoFoam=true' 
  94. ),  
  95. 'edit-product_cat' => array( 
  96. 'title' => __( 'Product Categories', 'woocommerce' ),  
  97. 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true' 
  98. ),  
  99. 'edit-product_tag' => array( 
  100. 'title' => __( 'Product Categories, Tags, Shipping Classes, & Attributes', 'woocommerce' ),  
  101. 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true' 
  102. ),  
  103. 'product_attributes' => array( 
  104. 'title' => __( 'Product Categories, Tags, Shipping Classes, & Attributes', 'woocommerce' ),  
  105. 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true' 
  106. ),  
  107. 'wc-status' => array( 
  108. 'title' => __( 'System Status', 'woocommerce' ),  
  109. 'url' => '//fast.wistia.net/embed/iframe/xdn733nnhi?videoFoam=true' 
  110. ),  
  111. 'wc-reports' => array( 
  112. 'title' => __( 'Reports', 'woocommerce' ),  
  113. 'url' => '//fast.wistia.net/embed/iframe/6aasex0w99?videoFoam=true' 
  114. ),  
  115. 'edit-shop_coupon' => array( 
  116. 'title' => __( 'Coupons', 'woocommerce' ),  
  117. 'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true' 
  118. ),  
  119. 'shop_coupon' => array( 
  120. 'title' => __( 'Coupons', 'woocommerce' ),  
  121. 'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true' 
  122. ),  
  123. 'edit-shop_order' => array( 
  124. 'title' => __( 'Managing Orders', 'woocommerce' ),  
  125. 'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true' 
  126. ),  
  127. 'shop_order' => array( 
  128. 'title' => __( 'Managing Orders', 'woocommerce' ),  
  129. 'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true' 
  130. ); 
  131.  
  132. $page = empty( $_GET['page'] ) ? '' : sanitize_title( $_GET['page'] ); 
  133. $tab = empty( $_GET['tab'] ) ? '' : sanitize_title( $_GET['tab'] ); 
  134. $section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( $_REQUEST['section'] ); 
  135. $video_key = $page ? implode( '-', array_filter( array( $page, $tab, $section ) ) ) : $screen->id; 
  136.  
  137. // Fallback for sections 
  138. if ( ! isset( $video_map[ $video_key ] ) ) { 
  139. $video_key = $page ? implode( '-', array_filter( array( $page, $tab ) ) ) : $screen->id; 
  140.  
  141. // Fallback for tabs 
  142. if ( ! isset( $video_map[ $video_key ] ) ) { 
  143. $video_key = $page ? $page : $screen->id; 
  144.  
  145. if ( isset( $video_map[ $video_key ] ) ) { 
  146. $screen->add_help_tab( array( 
  147. 'id' => 'woocommerce_101_tab',  
  148. 'title' => __( 'WooCommerce 101', 'woocommerce' ),  
  149. 'content' => 
  150. '<h2><a href="https://docs.woocommerce.com/document/woocommerce-101-video-series/?utm_source=helptab&utm_medium=product&utm_content=videos&utm_campaign=woocommerceplugin">' . __( 'WooCommerce 101', 'woocommerce' ) . '</a> – ' . esc_html( $video_map[ $video_key ]['title'] ) . '</h2>' . 
  151. '<iframe data-src="' . esc_url( $video_map[ $video_key ]['url'] ) . '" src="" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="480" height="298"></iframe>' 
  152. ) ); 
  153.  
  154. $screen->add_help_tab( array( 
  155. 'id' => 'woocommerce_support_tab',  
  156. 'title' => __( 'Help & Support', 'woocommerce' ),  
  157. 'content' => 
  158. '<h2>' . __( 'Help & Support', 'woocommerce' ) . '</h2>' . 
  159. '<p>' . sprintf( 
  160. __( 'Should you need help understanding, using, or extending WooCommerce, %splease read our documentation%s. You will find all kinds of resources including snippets, tutorials and much more.' , 'woocommerce' ),  
  161. '<a href="https://docs.woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin">',  
  162. '</a>' 
  163. ) . '</p>' . 
  164. '<p>' . sprintf( 
  165. __( 'For further assistance with WooCommerce core you can use the %scommunity forum%s. If you need help with premium add-ons sold by WooThemes, please %suse our helpdesk%s.', 'woocommerce' ),  
  166. '<a href="https://wordpress.org/support/plugin/woocommerce">',  
  167. '</a>',  
  168. '<a href="https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin">',  
  169. '</a>' 
  170. ) . '</p>' . 
  171. '<p>' . __( 'Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce' ) . '</p>' . 
  172. '<p><a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button button-primary">' . __( 'System Status', 'woocommerce' ) . '</a> <a href="' . 'https://wordpress.org/support/plugin/woocommerce' . '" class="button">' . __( 'Community Forum', 'woocommerce' ) . '</a> <a href="' . 'https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin' . '" class="button">' . __( 'WooThemes Helpdesk', 'woocommerce' ) . '</a></p>' 
  173. ) ); 
  174.  
  175. $screen->add_help_tab( array( 
  176. 'id' => 'woocommerce_bugs_tab',  
  177. 'title' => __( 'Found a bug?', 'woocommerce' ),  
  178. 'content' => 
  179. '<h2>' . __( 'Found a bug?', 'woocommerce' ) . '</h2>' . 
  180. '<p>' . sprintf( __( 'If you find a bug within WooCommerce core you can create a ticket via <a href="%s">Github issues</a>. Ensure you read the <a href="%s">contribution guide</a> prior to submitting your report. To help us solve your issue, please be as descriptive as possible and include your <a href="%s">system status report</a>.', 'woocommerce' ), 'https://github.com/woothemes/woocommerce/issues?state=open', 'https://github.com/woothemes/woocommerce/blob/master/.github/CONTRIBUTING.md', admin_url( 'admin.php?page=wc-status' ) ) . '</p>' . 
  181. '<p><a href="' . 'https://github.com/woothemes/woocommerce/issues?state=open' . '" class="button button-primary">' . __( 'Report a bug', 'woocommerce' ) . '</a> <a href="' . admin_url( 'admin.php?page=wc-status' ) . '" class="button">' . __( 'System Status', 'woocommerce' ) . '</a></p>' 
  182.  
  183. ) ); 
  184.  
  185. $screen->add_help_tab( array( 
  186. 'id' => 'woocommerce_education_tab',  
  187. 'title' => __( 'Education', 'woocommerce' ),  
  188. 'content' => 
  189. '<h2>' . __( 'Education', 'woocommerce' ) . '</h2>' . 
  190. '<p>' . __( 'If you would like to learn about using WooCommerce from an expert, consider following a WooCommerce course ran by one of our educational partners.', 'woocommerce' ) . '</p>' . 
  191. '<p><a href="' . 'https://woocommerce.com/educational-partners/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin' . '" class="button button-primary">' . __( 'View Education Partners', 'woocommerce' ) . '</a></p>' 
  192. ) ); 
  193.  
  194. $screen->add_help_tab( array( 
  195. 'id' => 'woocommerce_onboard_tab',  
  196. 'title' => __( 'Setup Wizard', 'woocommerce' ),  
  197. 'content' => 
  198. '<h2>' . __( 'Setup Wizard', 'woocommerce' ) . '</h2>' . 
  199. '<p>' . __( 'If you need to access the setup wizard again, please click on the button below.', 'woocommerce' ) . '</p>' . 
  200. '<p><a href="' . admin_url( 'index.php?page=wc-setup' ) . '" class="button button-primary">' . __( 'Setup Wizard', 'woocommerce' ) . '</a></p>' 
  201.  
  202. ) ); 
  203.  
  204. $screen->set_help_sidebar( 
  205. '<p><strong>' . __( 'For more information:', 'woocommerce' ) . '</strong></p>' . 
  206. '<p><a href="' . 'https://woocommerce.com/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin' . '" target="_blank">' . __( 'About WooCommerce', 'woocommerce' ) . '</a></p>' . 
  207. '<p><a href="' . 'https://wordpress.org/extend/plugins/woocommerce/' . '" target="_blank">' . __( 'WordPress.org Project', 'woocommerce' ) . '</a></p>' . 
  208. '<p><a href="' . 'https://github.com/woothemes/woocommerce' . '" target="_blank">' . __( 'Github Project', 'woocommerce' ) . '</a></p>' . 
  209. '<p><a href="' . 'https://woocommerce.com/product-category/themes/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin' . '" target="_blank">' . __( 'Official Themes', 'woocommerce' ) . '</a></p>' . 
  210. '<p><a href="' . 'https://woocommerce.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin' . '" target="_blank">' . __( 'Official Extensions', 'woocommerce' ) . '</a></p>' 
  211. ); 
  212.