Implemented Reported Posts - Email Notification

This suggestion has been implemented. Votes are no longer accepted.
A big yes for this - We can't be online 24 hours a day.
smile.png
 
.... if I'm not notified that something has been reported when I'm offline.

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?
 
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?
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.
 
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.

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.
 
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?
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.
 
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! ;)
 
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
 
me and everyone in the mods group.
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)
 
I just coded this myself. Me and the Super Mods will get an email about a new reported item. ALL GOOD!
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? :) )
 
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? :) )

I am not really good at creating plug-ins, but I will post how I did it here. It is actually pretty easy. ;)
 
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.
 
Top Bottom