diff options
Diffstat (limited to 'plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php')
-rw-r--r-- | plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php b/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php index 6e2d9a9..9143f37 100644 --- a/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php +++ b/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php @@ -207,6 +207,32 @@ function gnutaler_init_gateway_class() // This action hook saves the settings add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); + + + // Modify OIDC connect button text for Reclaim:ID + // (Note: this probably doesn't belong here!) + add_filter('openid-connect-generic-login-button-text', function( $text ) { + $text = __('Login with Re:ClaimID'); + return $text; + }); + + // make sure OIDC 'login' goes to WooCommerce + // (Note: this probably doesn't belong here, but maybe into the + // OIDC button hook for WC!?) + + add_action('openid-connect-generic-redirect-user-back', + function( $redirect_url, $user ) { + // Take over the redirection complete. Send users somewhere special based on their capabilities. + global $woocommerce; + // FIXME: check if WC is actually running first? + $checkout_url = $woocommerce->cart->wc_get_checkout_url (); + wp_redirect( $checkout_url); // or admin_url( $checkout_url) )?; + exit(); + } + }, 10, 2); + $user = wp_get_current_user (); + $token_response = $user->get('openid-connect-generic-last-token-response'); + } |