From 0ce51fcb877d474ea04dbde749f7226ea8cd141f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 28 Aug 2017 09:14:50 +0200 Subject: [PATCH] Fix: add resprint for passwordforgotten --- htdocs/core/tpl/passwordforgotten.tpl.php | 32 ++++++++++++++++++----- htdocs/user/passwordforgotten.php | 13 +++++++-- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index f901ed14318..9e155be88c9 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -88,14 +88,20 @@ if ($disablenofollow) echo ''; resArray['options'])) { - foreach ($hookmanager->resArray['options'] as $format => $option) - { - if ($format == 'table') { - echo ''; - echo $option; +if (! empty($morelogincontent)) { + if (is_array($morelogincontent)) { + foreach ($morelogincontent as $format => $option) + { + if ($format == 'table') { + echo ''; + echo $option; + } } } + else { + echo ''; + echo $morelogincontent; + } } ?> @@ -175,6 +181,20 @@ if (! empty($hookmanager->resArray['options'])) { + $option) + { + if ($format == 'js') { + echo "\n".''; + echo $option."\n"; + } + } +} +else if (! empty($moreloginextracontent)) { + echo ''; + echo $moreloginextracontent; +} +?> diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 4efe56b0ac1..9c2aabd3654 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -224,10 +224,19 @@ if (function_exists("imagecreatefrompng") && ! $disabled) $captcha_refresh = img_picto($langs->trans("Refresh"),'refresh','id="captcha_refresh_img"'); } -// Execute hook getPasswordForgottenPageOptions -// Should be an array with differents options in $hookmanager->resArray +// Execute hook getPasswordForgottenPageOptions (for table) $parameters=array('entity' => GETPOST('entity','int')); $hookmanager->executeHooks('getPasswordForgottenPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks +if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) { + $morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility +} else { + $morelogincontent = $hookmanager->resPrint; +} + +// Execute hook getPasswordForgottenPageExtraOptions (eg for js) +$parameters=array('entity' => GETPOST('entity','int')); +$reshook = $hookmanager->executeHooks('getPasswordForgottenPageExtraOptions',$parameters); // Note that $action and $object may have been modified by some hooks. +$moreloginextracontent = $hookmanager->resPrint; include $template_dir.'passwordforgotten.tpl.php'; // To use native PHP