WooCommerce_Simple_Registration_WC_Social_Login

WooCommerce Social Login Support.

Defined (1)

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

/includes/wc-social-login.php  
  1. class WooCommerce_Simple_Registration_WC_Social_Login{ 
  2.  
  3. /** 
  4. * Returns the instance. 
  5. */ 
  6. public static function get_instance() { 
  7. static $instance = null; 
  8. if ( is_null( $instance ) ) $instance = new self; 
  9. return $instance; 
  10.  
  11. /** 
  12. * Constructor. 
  13. */ 
  14. public function __construct() { 
  15.  
  16. /** Add Simple Registration Shortcode in "Display" Settings */ 
  17. add_filter( 'woocommerce_social_login_settings', array( $this, 'settings' ) ); 
  18.  
  19. /** Render Buttons */ 
  20. add_action( 'woocommerce_register_form_end', array( $this, 'render_social_login_buttons' ) ); 
  21.  
  22. /** 
  23. * Display Settings 
  24. */ 
  25. public function settings( $settings ) { 
  26.  
  27. /** Get the section */ 
  28. $key = false; 
  29. foreach( $settings as $k => $v ) { 
  30. if( isset( $v['id'] ) && 'wc_social_login_display' == $v['id'] ) { 
  31. $key = $k; 
  32. break; 
  33. /** Bail, if section not found */ 
  34. if( false === $key ) { 
  35. return $settings; 
  36.  
  37. /** Add "Simple Registration" in Display Option So User can enable/disable it. */ 
  38. $settings[$key]['options']['woocommerce_simple_registration'] = __( 'Simple Registration', 'woocommerce-simple-registration' ); 
  39.  
  40. return $settings; 
  41.  
  42. /** 
  43. * Whether social login buttons are displayed on simple registration shortcode 
  44. */ 
  45. public function is_displayed_on( $handle = 'woocommerce_simple_registration' ) { 
  46. return in_array( 'woocommerce_simple_registration', apply_filters( 'wc_social_login_display', (array) get_option( 'wc_social_login_display', array() ) ) ); 
  47.  
  48. /** 
  49. * Render social login buttons on frontend 
  50. */ 
  51. public function render_social_login_buttons() { 
  52. /** Bail if not enabled in simple registration output */ 
  53. if( ! $this->is_displayed_on() ) { 
  54. return; 
  55. /** Bail if in account page and this page already have login button. */ 
  56. if ( is_account_page() && $this->is_displayed_on( 'my_account' ) ) { 
  57. return; 
  58. /** Render button. */ 
  59. woocommerce_social_login_buttons( wc_get_page_permalink( 'myaccount' ) ); 
  60.