We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28928
    • 6 Posts

    Where can I activate the E-Mail Notification of JOT? Currently I’ve set that only contributions will be acti vated after verification. It all works fine. Only I wants to be informed via e-mail if someone has made an entry.
      • 4041
      • 788 Posts
      In your Jot snippet call, you’ll need to add the following two parameters:

      [!Jot? &otherparams=``... &canmoderate=`Site Admins` &notify=`2`!]


      In the example above,
      &canmoderate=`` needs to be a valid web group(s) who can moderate the comments, and which the person who needs to receive the notification is a member (for more than one group, it needs to be a comma delimited list). Note that every member of the moderate group will receive the notification email.

      &notify=`2` will trigger the notification to be sent.

      (While testing this I found that the comment creators name and email are blank in the notification email for some reason.)


        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 28928
        • 6 Posts

        I use the following code:

        [!Jot? &subscribe=`1` &notify=`2` &moderated=`1` &canedit=`Site Admins, Registered Users, bianca` &moderated=`1` &trusted=`Site Admins, Registered Users` !]

        Actually, it should work. The contact form works.
          • 4041
          • 788 Posts
          If you have a look at the Jot code (assets/snippets/jot/jot.class.inc.php), the notifications are triggered on line 615 - 622. The notification functions start at line 652 - 739.

          It looks to me that the &notify param will only work if the &canmoderate param is set.

          http://wiki.modxcms.com/index.php/Jot
            xforum
            http://frsbuilders.net (under construction) forum for evolution
            • 28928
            • 6 Posts

            I am actually an ASP Programmierin. For me, everything looks right.


            		
            	// Notifications
            	function doNotifySubscribers($commentid=0) {
            		global $modx;
            		if ($this->config["subscription"]["enabled"]) {
            				
            				// Get comment fields
            				$cObj = $this->provider;
            				$cObj->Comment($commentid);
            				$comment = $cObj->getFields();
            				unset($cObj);
            																
            				$subscriptions = $this->provider->getSubscriptions($this->config["docid"],$this->config["tagid"]);
            				$count = count($subscriptions);
            				for ($i = 0; $i < $count; $i++) {
            						if ($this->config["user"]["id"] != $subscriptions[$i]["userid"] ) {
            							$user = $this->getUserInfo($subscriptions[$i]["userid"]);
            							$tpl = new CChunkie($this->templates["notify"]);
            							$tpl->AddVar('jot',$this->config);
            							$tpl->AddVar('comment',$comment);
            							$tpl->AddVar('siteurl',"http://".$_SERVER["SERVER_NAME"]);
            							$tpl->AddVar('recipient',$user);
            							$message = $tpl->Render();
            							mail($user["email"], $this->config["subject"]["subscribe"], $message, "From: ".$modx->config['emailsender']."\r\n"."X-Mailer: Content Manager - PHP/".phpversion());
            						}
            				}
            		}
            	}
            	
            	// Moderator Notification
            	function doNotifyModerators($commentid=0) {
            		global $modx;
            		if ($this->config["moderation"]["notify"]) {
            
            		  // Get comment fields
            			$cObj = $this->provider;
            			$cObj->Comment($commentid);
            			$comment = $cObj->getFields();
            			unset($cObj);
            					
            			$moderators = $this->getMembersOfWebGroup($this->config["permissions"]["moderate"]);
            			foreach ($moderators as $moderator){
            				$user = $modx->getWebUserInfo($moderator);
            				$tpl = new CChunkie($this->templates["notifymoderator"]);
            				$tpl->AddVar('jot',$this->config);
            				$tpl->AddVar('comment',$comment);
            				$tpl->AddVar('siteurl',"http://".$_SERVER["SERVER_NAME"]);
            				$tpl->AddVar('recipient',$user);
            				$message = $tpl->Render();
            				mail($user["email"], $this->config["subject"]["moderate"], $message, "From: ".$modx->config['emailsender']."\r\n"."X-Mailer: Content Manager - PHP/".phpversion());
            			}
            		}
            	}
            	
            	// Returns comment count
            	function getCommentCount($view=1) {
            		return $this->provider->GetCommentCount($this->config["docid"],$this->config["tagid"],$view);
            	}
            
            	// Moderation
            	function doModerate($action = '',$id = 0) {
            		$output = NULL;
            		$pObj = $this->provider;
            		if ($this->isModerator && $pObj->isValidComment($this->config["docid"],$this->config["tagid"],$id)) {
            			switch ($action) {
            				case "delete":
            					$pObj->Comment($id);
            					$pObj->Delete();
            					break;
            				case "publish":
            					$pObj->Comment($id);
            					$pObj->Set("publishedon",$this->_ctime);
            					$pObj->Set("publishedby",$this->config["user"]["id"]);
            					$pObj->Set("published",1);
            					$pObj->Save();
            					$this->doNotifySubscribers($id);
            					break;
            				case "edit":
            					$this->form["moderation"] = 1;
            					$this->form["edit"] = 1;
            					break;		
            				case "save":
            					$this->form["moderation"] = 1;
            					$this->form["edit"] = 1;
            					$this->form["save"] = 1;
            					break;							
            				case "unpublish":
            					$pObj->Comment($id);
            					$pObj->Set("publishedon",$this->_ctime);
            					$pObj->Set("publishedby",$this->config["user"]["id"]);
            					$pObj->Set("published",0);
            					$pObj->Save();
            					break;
            				}
            			
            		}
            		unset($pObj);
            		return $output;
            	}
            
              • 16430
              • 217 Posts
              I can only get notification if author notification =1. But I have only two moderator account including admin, and would like to recieve notification on these two emails everytime somebody post a comment.
              Is there a way?

              [!Jot? &customfields=`name, email` &subscribe=`1` &captcha=`1` &pagination=`10`  &bw=`2` &canmoderate=`admin, others` &moderated=`0` &guestname=`Anonym`  &notify=`2` &notifyAuthor=`0`  !]