From 76a0eba1a0e2848ce3573bcff6f6865cdff9d110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 23 Oct 2020 18:49:06 +0200 Subject: [PATCH] add hook on public new member card --- htdocs/public/members/new.php | 15 +++++++++++---- htdocs/public/members/public_card.php | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index f1fcfc04e37..d01e7d7240b 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -73,6 +73,9 @@ if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) exit; } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('publicnewmembercard', 'globalcard')); + $extrafields = new ExtraFields($db); $object = new Adherent($db); @@ -152,10 +155,15 @@ function llxFooterVierge() /* * Actions */ +$parameters = array(''); +// Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} // Action called when page is submitted -if ($action == 'add') -{ +if (empty($reshook) && $action == 'add') { $error = 0; $urlback = ''; @@ -454,8 +462,7 @@ if ($action == 'add') // Action called after a submitted was send and member created successfully // If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url. // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. -if ($action == 'added') -{ +if (empty($reshook) && $action == 'added') { llxHeaderVierge($langs->trans("NewMemberForm")); // Si on a pas ete redirige diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index c1677b2902b..427aa2cf4a3 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -92,7 +92,7 @@ if ($id > 0) print ''.$langs->trans("Firstname").''.$object->firstname.' '; print ''.$langs->trans("Lastname").''.$object->lastname.' '; print ''.$langs->trans("Gender").''.$object->gender.' '; - print ''.$langs->trans("Company").''.$object->societe.' '; + print ''.$langs->trans("Company").''.$object->company.' '; print ''.$langs->trans("Address").''.nl2br($object->address).' '; print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''.$object->zip.' '.$object->town.' '; print ''.$langs->trans("Country").''.$object->country.' ';