Skip to content

Commit

Permalink
Pass saml_attributes along to saml_hook_post_user_created hook
Browse files Browse the repository at this point in the history
All of the other hooks receive the attributes.  I want to do some arbitrary actions in a custom hook on the site I'm working on based on attributes, this seems like the easiest way to do it.
  • Loading branch information
jamesgol committed May 9, 2016
1 parent 3cbc67f commit 07d9fa3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion auth/saml/custom_hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@ function saml_hook_authorize_user($username, $saml_attributes, $authorize_user)
name: saml_hook_post_user_created
arguments:
- $user: object containing the Moodle user
- $saml_attributes: array of SAML attributes
return value:
- nothing
purpose: use this function if you want to make changes to the user object
or update any external system for statistics or something similar.
*/
function saml_hook_post_user_created($user) {
function saml_hook_post_user_created($user, $saml_attributes = array()) {

}
2 changes: 1 addition & 1 deletion auth/saml/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
$USER = complete_user_login($user);

if (function_exists('saml_hook_post_user_created')) {
saml_hook_post_user_created($USER);
saml_hook_post_user_created($USER, $saml_attributes);
}

if (isset($SESSION->wantsurl) && !empty($SESSION->wantsurl)) {
Expand Down

0 comments on commit 07d9fa3

Please sign in to comment.