summaryrefslogtreecommitdiff
path: root/snippets/oidc-reclaim.php
diff options
context:
space:
mode:
Diffstat (limited to 'snippets/oidc-reclaim.php')
-rw-r--r--snippets/oidc-reclaim.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/snippets/oidc-reclaim.php b/snippets/oidc-reclaim.php
new file mode 100644
index 0000000..cbb2f8c
--- /dev/null
+++ b/snippets/oidc-reclaim.php
@@ -0,0 +1,23 @@
+/**
+ * This snipped integrates the OIDC connect button with WooCommerce
+ * to allow importing the customer's shopping details via OIDC / Re:ClaimID
+ */
+
+// Modify OIDC connect button text for Reclaim:ID
+add_filter('openid-connect-generic-login-button-text', function( $text ) {
+ $text = __('Login with Re:ClaimID', 'gnutaler' );
+ return $text;
+});
+
+// make sure OIDC 'login' goes to WooCommerce checkout URL.
+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;
+ $checkout_url = $woocommerce->cart->wc_get_checkout_url ();
+ wp_redirect( $checkout_url); // or admin_url( $checkout_url) )?;
+ exit();
+ },
+ 10,
+ 2);