We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4855
    • 28 Posts
    I’m going to be working on a site that requires several levels of user permissions and management, and the administrator level would like to receive message notifications (using message module in modx)when the content creators put up content to review the content so they can log in, make any edits, and publish it. Is this possible with any existing extras or will it require some custom programming?
      • 4385
      • 372 Posts
        DropboxUploader -- Upload files to a Dropbox account.
        DIG -- Dynamic Image Generator
        gus -- Google URL Shortener
        makeQR -- Uses google chart api to make QR codes.
        MODxTweeter -- Update your twitter status on publish.
        • 4041
        • 788 Posts
        Heres another plugin that works only when a new doc is created and allows an array of email recipients:

        <?php // do not copy this line, it's only for highlighting and will break the plugin
        /*  Admin_Notify_NewDoc_plugin.php
            usage:
            * Create a new plugin with this code
            * On the System Events tab, check the following event
              OnDocFormSave
        */
        $doc_info = $modx->getPageInfo($id);
        
        // MODIFIABLE SETTINGS
        // set up a comma delimited list of the address(s) which will receive the notifications
        $recipient_email_array = array('[email protected]','[email protected]');
        
        // set up the content of the email message
        $email_content_string =$doc_info["pagetitle"].' (#'.$id.') has been created. Please login to the manager to review/publish the document.';
        
        // set up the email subject
        $email_subject ='New Document (#'.$id.') Created';
        
        // Handle event
        $e = &$modx->Event;
        switch ($e->name) {
        
        case 'OnDocFormSave':
              if($mode =='new'){
                  if(isset($recipient_email_array)){
                    $countarray = count($recipient_email_array);
                    if($countarray > 0 ){
                        foreach ($recipient_email_array as $r_e_array){
        
                            // send html email receipt to admin(s)
                            mail($r_e_array,
                                 $email_subject,
                                 $email_content_string,
                                 "From: ".$modx->config['site_name']." <".$modx->config['emailsender']."> \n".
                                 "MIME-Version: 1.0 \n" .
                                 "Content-type: text/html; charset=iso-8859-1");
                         }
                     }
                 }
              }
              break;
        
        default: '';
        
          return;
        }
          xforum
          http://frsbuilders.net (under construction) forum for evolution
          • 4855
          • 28 Posts
          Thanks for your replay..

          but any idea how to using native messages system from modx (not using email)?
          i mean the notification show in messages inbox in manager page. The notofication didn’t use email, only use messages system from modx in manager page.

          Modx does have messages system in the manager page, right?i want use that instead of using email to send notification, so the Manager/admin only have to login in manager area modx to look notoification.

          Thanks again for replay, sorry for my bad english...
            • 4041
            • 788 Posts
            Sure, in that case this should work:

            <?php // do not copy this line
            /*  Admin_Notify_NewDoc_plugin.php
                usage:
                * Create a new plugin with this code
                * On the System Events tab, check the following event
                  OnDocFormSave
            */
            $doc_info = $modx->getPageInfo($id);
            
            // MODIFIABLE SETTINGS
            // set up a comma delimited list of the admin ID's which will receive the notifications
            $recipient_email_array = array('1', '2');
            
            // set up the content of the email message
            $email_message =$doc_info["pagetitle"].' (#'.$id.') has been created and needs to be reviewed/published.';
            
            // set up the email subject
            $email_subject ='New Document (#'.$id.') Created';
            
            // Handle event
            $e = &$modx->Event;
            switch ($e->name) {
            
            case 'OnDocFormSave':
                  if($mode =='new'){
                      if(isset($recipient_email_array)){
                        $countarray = count($recipient_email_array);
                        if($countarray > 0 ){
                            foreach ($recipient_email_array as $r_e_array){
            
                                $sql2 = "INSERT INTO ".$modx->getFullTableName( 'user_messages' )." ( id , type , subject , message , sender , recipient , private , postdate , messageread )
                                         VALUES ( '', '', '".$email_subject."', '".$email_message."', 'Publishing Notification System', '".$r_e_array."', '0', '".time()."', '0' );";
                                $rs2 = $modx->dbQuery($sql2);
                                
                             }
                         }
                     }
                  }
                  break;
            
            default: '';
            
              return;
            }
              xforum
              http://frsbuilders.net (under construction) forum for evolution
              • 4855
              • 28 Posts
              Wow, thank you very much..
                • 4385
                • 372 Posts
                The message I link to earlier uses internal messaging too. Using the built in api.

                $modx->sendAlert(’alert’,1,1,$subject,$message . $docLink,1);
                  DropboxUploader -- Upload files to a Dropbox account.
                  DIG -- Dynamic Image Generator
                  gus -- Google URL Shortener
                  makeQR -- Uses google chart api to make QR codes.
                  MODxTweeter -- Update your twitter status on publish.