diff --git a/admin/tool/mobile/classes/local/hooks/user/after_complete_login.php b/admin/tool/mobile/classes/hook_callbacks.php
similarity index 81%
rename from admin/tool/mobile/classes/local/hooks/user/after_complete_login.php
rename to admin/tool/mobile/classes/hook_callbacks.php
index 4032c73f91b..5e3efe54227 100644
--- a/admin/tool/mobile/classes/local/hooks/user/after_complete_login.php
+++ b/admin/tool/mobile/classes/hook_callbacks.php
@@ -14,23 +14,26 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-namespace tool_mobile\local\hooks\user;
+namespace tool_mobile;
+
use core\session\utility\cookie_helper;
/**
- * Handles mobile app launches when a third-party auth plugin did not properly set $SESSION->wantsurl.
+ * Allows plugins to add any elements to the footer.
*
* @package tool_mobile
* @copyright 2024 Juan Leyva
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class after_complete_login {
+class hook_callbacks {
/**
* Callback to recover $SESSION->wantsurl.
*
- * @param \core\hook\user\after_complete_login $hook
+ * @param \core_user\hook\after_login_completed $hook
*/
- public static function callback(\core\hook\user\after_complete_login $hook): void {
+ public static function after_login_completed(
+ \core_user\hook\after_login_completed $hook,
+ ): void {
global $SESSION, $CFG;
// Check if the user is doing a mobile app launch, if that's the case, ensure $SESSION->wantsurl is correctly set.
@@ -43,7 +46,10 @@ class after_complete_login {
// Set Partitioned and Secure attributes to the MoodleSession cookie if the user is using the Moodle app.
if (\core_useragent::is_moodle_app()) {
- cookie_helper::add_attributes_to_cookie_response_header('MoodleSession'.$CFG->sessioncookie, ['Secure', 'Partitioned']);
+ cookie_helper::add_attributes_to_cookie_response_header(
+ 'MoodleSession' . $CFG->sessioncookie,
+ ['Secure', 'Partitioned'],
+ );
}
}
}
diff --git a/admin/tool/mobile/db/hooks.php b/admin/tool/mobile/db/hooks.php
index 61bc9fac19f..e0cca6e7cbc 100644
--- a/admin/tool/mobile/db/hooks.php
+++ b/admin/tool/mobile/db/hooks.php
@@ -26,8 +26,8 @@ defined('MOODLE_INTERNAL') || die();
$callbacks = [
[
- 'hook' => core\hook\user\after_complete_login::class,
- 'callback' => 'tool_mobile\local\hooks\user\after_complete_login::callback',
+ 'hook' => \core_user\hook\after_login_completed::class,
+ 'callback' => \tool_mobile\hook_callbacks::class . '::after_login_completed',
'priority' => 500,
],
[
diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 4b4e128e016..a7c892e7e08 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -4588,7 +4588,7 @@ function complete_user_login($user, array $extrauserinfo = []) {
$event->trigger();
// Allow plugins to callback as soon possible after user has completed login.
- $hook = new \core\hook\user\after_complete_login();
+ $hook = new \core_user\hook\after_login_completed();
\core\hook\manager::get_instance()->dispatch($hook);
// Check if the user is using a new browser or session (a new MoodleSession cookie is set in that case).
diff --git a/lib/classes/hook/user/after_complete_login.php b/user/classes/hook/after_login_completed.php
similarity index 77%
rename from lib/classes/hook/user/after_complete_login.php
rename to user/classes/hook/after_login_completed.php
index 0377cfd8b61..fd0840fbca4 100644
--- a/lib/classes/hook/user/after_complete_login.php
+++ b/user/classes/hook/after_login_completed.php
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-namespace core\hook\user;
+namespace core_user\hook;
use core\hook\described_hook;
use core\hook\stoppable_trait;
@@ -22,29 +22,23 @@ use core\hook\stoppable_trait;
/**
* Allow plugins to callback as soon possible after user has completed login.
*
- * @package core
+ * @package core_user
* @copyright 2024 Juan Leyva
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class after_complete_login implements described_hook,
- \Psr\EventDispatcher\StoppableEventInterface {
+class after_login_completed implements
+ described_hook,
+ \Psr\EventDispatcher\StoppableEventInterface
+{
use stoppable_trait;
-
- /**
- * Describes the hook purpose.
- *
- * @return string
- */
public static function get_hook_description(): string {
return 'Allow plugins to callback as soon possible after user has completed login.';
}
- /**
- * List of tags that describe this hook.
- *
- * @return string[]
- */
public static function get_hook_tags(): array {
- return ['login'];
+ return [
+ 'login',
+ 'user',
+ ];
}
}