diff --git a/includes/openid-connect-generic-client-wrapper.php b/includes/openid-connect-generic-client-wrapper.php index 545ba3d..3e7890b 100644 --- a/includes/openid-connect-generic-client-wrapper.php +++ b/includes/openid-connect-generic-client-wrapper.php @@ -253,6 +253,10 @@ class OpenID_Connect_Generic_Client_Wrapper { if ( ! $user ) { $user = $this->create_new_user( $subject_identity, $user_claim ); } + else { + // allow plugins / themes to take action using current claims on existing user (e.g. update role) + do_action( 'openid-connect-generic-update-user-using-current-claim', $user, $user_claim ); + } // validate the found / created user $valid = $this->validate_user( $user ); diff --git a/openid-connect-generic.php b/openid-connect-generic.php index c6249a1..021b230 100644 --- a/openid-connect-generic.php +++ b/openid-connect-generic.php @@ -22,6 +22,7 @@ Notes Actions - openid-connect-generic-user-create - 2 args: fires when a new user is created by this plugin + - openid-connect-generic-update-user-using-current-claim - 2 args: fires every time an existing user logs User Meta - openid-connect-generic-user - (bool) if the user was created by this plugin diff --git a/readme.md b/readme.md index bacbfd6..3130064 100644 --- a/readme.md +++ b/readme.md @@ -32,6 +32,9 @@ by this client is like so: `https://example.com/wp-admin/admin-ajax.php?action= Replace `example.com` with your domain name and path to WordPress. ### Changelog +**3.0.8** +* Added [openid-connect-generic-update-user-using-current-claim] action hook allowing other plugins/themes + to take action using the fresh claims received when an existing user logs in. **3.0.7** * When requesting userinfo, send the access token using the Authorization header field as recommended in diff --git a/readme.txt b/readme.txt index f3ffac5..aaca4ea 100644 --- a/readme.txt +++ b/readme.txt @@ -39,6 +39,9 @@ Replace `example.com` with your domain name and path to WordPress. == Changelog == += 3.0.8 = +* Added [openid-connect-generic-update-user-using-current-claim] action hook allowing other plugins/themes + to take action using the fresh claims received when an existing user logs in. = 3.0.7 =