From fa8e4a71e0d7ba738240cfbf2e840fa2edb6547b Mon Sep 17 00:00:00 2001 From: Nina Date: Thu, 1 Jun 2023 03:34:56 -0400 Subject: [PATCH] Print error message returned by before_alternc_add_member hook --- bureau/class/m_admin.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bureau/class/m_admin.php b/bureau/class/m_admin.php index ef3c8200..713df0e6 100644 --- a/bureau/class/m_admin.php +++ b/bureau/class/m_admin.php @@ -639,13 +639,14 @@ class m_admin { return false; } // Additional checks before a user is created - // Do not create the account if any hook returned false + // Do not create the account if any hook has a return value + // The returned value should provide additional information $before_add_hook_data = $hooks->invoke('hook_before_alternc_add_member', [$login]); foreach($before_add_hook_data as $create) { - if(!$create) { - $msg->raise("ERROR", "admin", _("-- I cannot create this account --")); - return false; - } + if($create !== null) { + $msg->raise("ERROR", "admin", _("The account '%s' cannot be created. %s"), [$login, $create]); + return false; + } } $pass = password_hash($pass, PASSWORD_BCRYPT);