Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-50921

Popup Notifications Not Working for Noreply and Support IDs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.6, 2.9.1, 3.0
    • Fix Version/s: 2.8.9, 2.9.3
    • Component/s: Messages
    • Labels:
    • Testing Instructions:
      Hide
      1. Login as an admin
      2. Create a course
      3. Enrol a user into the course
      4. Create a forum activity in the course that students can post to.
      5. Enable event monitoring and setup an event monitoring rule for the forum event "Discussion created".
        • site administration > reports > event monitoring rules
      6. Subscribe to the new event
        • user menu (top right) > preferences > event monitoring
      7. Set messaging settings in the "Event monitor" section to allow "Popup notification"
        • user menu (top right) > preferences > messaging
      8. Login as a student in the course.
      9. Create a discussion in the forum
      10. Run the cron.
      11. Login as the admin
      12. CONFIRM: Popup notifications should show.

      Note: Depending on your event subscription settings you may need to wait 1 minute between cron runs to avoid the cool down period for notifications.

      Also you may want to comment out the code between lines 8601 and 8606 in lib/moodlelib.php which prevent multiple notifications of the same type within an hour:

      // If the user was last notified over an hour ago we can re-notify them of old messages
          // so don't worry about when the new message was sent.
          $lastnotifiedlongago = $USER->message_lastpopup < (time()-3600);
          if (!$lastnotifiedlongago) {
              $messagesql .= 'AND m.timecreated > :lastpopuptime';
          }
      

      Show
      Login as an admin Create a course Enrol a user into the course Create a forum activity in the course that students can post to. Enable event monitoring and setup an event monitoring rule for the forum event "Discussion created". site administration > reports > event monitoring rules Subscribe to the new event user menu (top right) > preferences > event monitoring Set messaging settings in the "Event monitor" section to allow "Popup notification" user menu (top right) > preferences > messaging Login as a student in the course. Create a discussion in the forum Run the cron. Login as the admin CONFIRM: Popup notifications should show. Note: Depending on your event subscription settings you may need to wait 1 minute between cron runs to avoid the cool down period for notifications. Also you may want to comment out the code between lines 8601 and 8606 in lib/moodlelib.php which prevent multiple notifications of the same type within an hour: // If the user was last notified over an hour ago we can re-notify them of old messages // so don't worry about when the new message was sent. $lastnotifiedlongago = $USER ->message_lastpopup < (time()-3600); if (! $lastnotifiedlongago ) { $messagesql .= 'AND m.timecreated > :lastpopuptime' ; }
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull Master Branch:
      MDL-50921-master

      Description

      Whenever messages are created with the useridfrom field set to -10 or -20, the message popups never show.

      Steps to recreate the problem:

      1. Login as an instructor, and navigate to one of your courses.
      2. Create a forum that students can post to.
      3. Setup an event monitoring rule for the forum event "Discussion created".
      4. Set messaging settings in the "Event monitor" section to allow "Popup notification"
      5. Login as a student in the course.
      6. Create a discussion in the forum
      7. Run the cron.
      8. Login as the instructor. Popup notifications should not show.

      I fixed the problem on my test instance by editing the "message_popup_window" function in "lib/moodlelib.php". I deleted the following line from the query:

      JOIN mdl_user u ON m.useridfrom=u.id

      This JOIN was causing no messages to be returned because the useridfrom field for those types of messages contained a "-10" (i.e. noreply user). After looking at the history of changes to that query, I don't think the JOIN is needed any longer.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Nov/15