diff --git a/module/blog/blog.php b/module/blog/blog.php index 395c8b1a..dbde3e6b 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -505,21 +505,21 @@ class blog extends common { } } // Envoi du mail $sent code d'erreur ou de réussite + $notification = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentId, 'approval']) === false ? 'Commentaire déposé en attente d\'approbation.': 'Commentaire déposé.'; if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'mailNotification']) === true) { $sent = $this->sendMail( $to, 'Nouveau commentaire', 'Bonjour' . ' ' . $user['firstname'] . ' ' . $user['lastname'] . ',

' . - 'Nouveau commentaire déposé sur la page "' . $this->getData(['page', $this->getUrl(0), 'title']) . '" :

'. + 'Nouveau commentaire ' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentId, 'approval']) === false ? 'à approuver' : '' . + 'déposé sur la page "' . $this->getData(['page', $this->getUrl(0), 'title']) . '" :

'. $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentId, 'content']), '' ); // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', - //'notification' => 'Commentaire ajouté', - //'state' => true - 'notification' => ($sent === true ? 'Commentaire ajouté et une notification envoyée' : 'Commentaire ajouté, erreur de notification :
' . $sent), + 'notification' => ($sent === true ? $notification . '
Une notification a été envoyée.' : $notification . '
Erreur de notification : ' . $sent), 'state' => ($sent === true ? true : null) ]); @@ -527,7 +527,7 @@ class blog extends common { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', - 'notification' => 'Commentaire ajouté', + 'notification' => $notification, 'state' => true ]); } @@ -599,8 +599,10 @@ class blog extends common { } else { self::$commentsSignature[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i],'author']); } - // Données du commentaire - self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i]]); + // Données du commentaire si approuvé + if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i],'approval']) === true ) { + self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i]]); + } } // Valeurs en sortie $this->addOutput([