diff --git a/inc/gamumail_remplacements.php b/inc/gamumail_remplacements.php index 220f06c..f587e56 100644 --- a/inc/gamumail_remplacements.php +++ b/inc/gamumail_remplacements.php @@ -14,22 +14,21 @@ if (!defined('_ECRIRE_INC_VERSION')) { **/ function inc_gamumail_remplacements_dist($args, $html) { /** - * @@nom@@ => Prenom Nom | Nom (gère la présence/absence du champ prenom dans spip_auteurs) + * @@nom@@ => $nom ou un espace pour vider le champ @@nom@@ **/ - $nom = sql_getfetsel('nom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0])); - $prenom = $nom; + $nom = sql_getfetsel('nom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0])) ?? ' '; + $html = gamumail_remplacer_modele('nom', ucwords($nom), $html); + + /** + * @@prenom@@ => $prenom ou un espace pour vider le champ @@prenom@@ + **/ + $prenom = ' '; $trouver_table = charger_fonction('trouver_table', 'base'); $desc = $trouver_table('spip_auteurs'); - if (array_key_exists('prenom', $desc['field']) - and $prenom = sql_getfetsel('prenom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0]))) { - $nom = $prenom.' '.$nom; - } - if ($nom) { - $html = gamumail_remplacer_modele('nom', ucwords($nom), $html); - } - if ($prenom) { - $html = gamumail_remplacer_modele('prenom', ucwords($prenom), $html); + if (array_key_exists('prenom', $desc['field'])) { + $prenom = sql_getfetsel('prenom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0])) ?? ' '; } + $html = gamumail_remplacer_modele('prenom', ucwords($prenom), $html); /** * @@url_site@@ => URL du site