1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Reported Posts - Email Notification

Discussion in 'XenForo Suggestions' started by MrDeranged, Oct 6, 2010.

  1. MrDeranged

    MrDeranged Well-Known Member

    There absolutely HAS to be this functionality. All the alerts when logged in, all the awesomeness of the spam cleaner means absolutely NOTHING if I'm not notified that something has been reported when I'm offline.
     
    Cozza, AdamCole, Mijo and 43 others like this.
  2. Darat

    Darat Member

    Yeah email notifications are very important (and of course my needs are always very important).
     
    Alien, Steve10, Dodgeboard and 2 others like this.
  3. Dean

    Dean Well-Known Member

    I am surprised this suggestion has not gotten more attention. Yes, for us, this would be an extremely desirable feature.
     
    Dodgeboard likes this.
  4. Simon

    Simon Active Member

    A big yes for this - We can't be online 24 hours a day. [​IMG]
     
    Dodgeboard likes this.
  5. Grover

    Grover Well-Known Member

    Just for my understanding: when you're offline you can't receive/read your mails anyway? And when you're online to receive them, one might as well have a look at the same time then at the site where the reports are? I guess I miss something in my thinking pattern, since more people are in need of this? It's late... who enlightens this old brain?
     
  6. akia

    akia Well-Known Member

    Unless you have a blackberry or other such phones and get emails as they arrive, like I do which would then prompt me to check the forum.
     
  7. Grover

    Grover Well-Known Member

    Ah, yes indeed I was in doubt if the TS meant by offline "away from the forum" or just disconnected/offline in general from the internet.

    I have to say that I never use the enormous amount of email-notfications anymore. I used to look at the them in the past, but nowadays I just go directly to the forum. If there would be an official smartphone App then push notifications could be used (or any other dedicated functionality that keeps you up-to-date), making the need of email notifications maybe less? But I guess others still might prefer email notifications.
     
  8. dieketzer

    dieketzer Well-Known Member

    i dont log into the admin account unless i need to admin.
    same goes for the moderators. they do not log in with them unless there is something to moderate.
    as it is, one has to regularly log in and check for notifications. there is no way to allow notifications without all the admin distinction, nor are there any emails or pc's sent out. its not a good situation, and one more example of xf only catering for one particular style of administrating.
     
    Jazzyname and Dodgeboard like this.
  9. soloarquitectura

    soloarquitectura Active Member

    Essential feature.
    We can not spend all day in the forum.
    (Well, actually yes, but that's another story :rolleyes: )
    
     
  10. robdog

    robdog Well-Known Member

    I stupidly created a duplicate thread, but I actually ran into a problem with users reporting items and no one getting a notification to fix the issue.

    This would be a pretty nice addition! ;)
     
  11. CyclingTribe

    CyclingTribe Well-Known Member

    What *does* happen when something is reported?
     
  12. robdog

    robdog Well-Known Member

    It will go into the reported queue and you will see a notification at the top bar when you are logged in to an account that has access to see reports. Nothing else beyond that I believe.
     
  13. CyclingTribe

    CyclingTribe Well-Known Member

    Ah, right, I see. Hmmm, yes, I think this would be useful.

    ATM I think our IPB setting emails me and everyone in the mods group.

    Cheers,
    Shaun :D
     
  14. ragtek

    ragtek Guest

    But this shouldn't happen:p

    Only people allowed to mange the reported content should get the mail and not every mod even he have no perm to manage the post because he's mod in an other category
    that's why i haven't released the add-on till now (ATM i'm using an hardcoded array for users which should get the mail)
     
    Brogan likes this.
  15. CyclingTribe

    CyclingTribe Well-Known Member

    All my mods are global ... ;)
     
  16. robdog

    robdog Well-Known Member

    I just coded this myself. Me and the Super Mods will get an email about a new reported item. ALL GOOD!
     
    GeeksChat likes this.
  17. AnthonyT

    AnthonyT Member

    Any plans to release this as an add-on?

    We rely quite heavily on notifications of reported posts in our vB set-up. It's useful because if someone is not online and its out of hours one of us can always jump in and deal with something real quick. Weekends as a prime example.

    I too would like to see this feature implemented as standard. (should be relatively straight forward, right? :) )
     
    GregF likes this.
  18. robdog

    robdog Well-Known Member

    I am not really good at creating plug-ins, but I will post how I did it here. It is actually pretty easy. ;)
     
    AnthonyT and GeeksChat like this.
  19. AnthonyT

    AnthonyT Member

    Please do :)
     
  20. robdog

    robdog Well-Known Member

    Okay, here is how I did. Going to be a step by step process to get this working and this will never be created as a plugin, lol. :)

    1. Create a folder under library called EmailReport.

    2. Create a file inside that new directory called Listener.php and put in the following code:
      PHP:
      <?php

      class EmailReport_Listener
      {
          public static function 
      extendModel($class, array &$extend)
          {
              if (
      $class == 'XenForo_Model_Report')
              {
                  
      $extend[] = 'EmailReport_Report';
              }
          }
      }
    3. Create another file inside that new directory called Report.php and put in the following code:
      PHP:
      <?php

      class EmailReport_Report extends XenForo_Model_Report
      {
          public function 
      reportContent($contentType, array $content$message, array $viewingUser null)
          {
              
      $reportId parent::reportContent($contentType$content$message$viewingUser);
              if (
      $reportId == 0)
              {
                  return 
      false;
              }
              
      $users $this->fetchAllKeyed('SELECT * FROM xf_user WHERE is_admin = 1''user_id');
              
      $report $this->getReportById($reportId);
              
      $reportComments $this->getReportComments($reportId);
              foreach (
      $users as $user)
              {
                  
      $params = array(
                      
      'user' => $user,
                      
      'report' => $report,
                      
      'reportComments' => $reportComments
                  
      );
                  
      $mail = new XenForo_Mail('new_item_reported'$params$user['language_id']);
                  
      $mail->send($user['email'], $user['username']);
              }
          }
      }
    4. Create an addon with the following values:
      Add-on ID: email_report
      Title: Email Report
      Version: 1.0.0
    5. Create a new email template with the following values:
      Template Title: new_item_reported
      Subject: New Item Has Been Reported!
      Plain Text Body:
      HTML:
      {$user.username},
      
      A new item has just been reported.
      
      To view the current report click on the following link:
      {$xenOptions.boardUrl}/reports/{$report.report_id}/
      HTML Body:
      HTML:
      <p>{$user.username},</p>
      
      <p>A new item has just been reported.</p>
      
      <p>
      To view the current report click on the following link:<br />
      <a href="{$xenOptions.boardUrl}/reports/{$report.report_id}/">{$xenOptions.boardUrl}/reports/{$report.report_id}/</a>
      </p>
      Add-on: Email Report
    6. Create a code event listener with the following values:
      Listen to Event: load_class_model
      Execute Callback: EmailReport::extendModel
      Add-on: Email Report

    Some Notes:
    • In step 3, you will see the actual SQL statement where it grabs the users to send. I my implementation, it will grab all the ADMIN users and loop through them to send the reported item.
    • In step 4, you can customize the subject, plain text body and html body.

    That should be it. Post a reply here if you have any issues with this and I will try to help as best I can.
     
    karll, dbembibre, Alien and 4 others like this.

Share This Page