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

Messaging: preference absence error uses non-existing variable

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.1, 2.2, 2.3
    • 2.1.6, 2.2.3
    • Messages
    • MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MDL-32026-master-2
    • Hide

      In order to test this, you need to replicate an attempt to send message using non-existing component or provider name. For example, you may modify file message/lib.php the way:

      --- a/message/lib.php
      +++ b/message/lib.php
      @@ -2006,7 +2006,7 @@ function message_post_message($userfrom, $userto, $message, $format) {
       
           $eventdata = new stdClass();
           $eventdata->component        = 'moodle';
      -    $eventdata->name             = 'instantmessage';
      +    $eventdata->name             = 'instantmessage_';
           $eventdata->userfrom         = $userfrom;
           $eventdata->userto           = $userto;

      Now try to send personal message to another user, upon the click "Send message", you will get coding exception that will contain the preference name causing error:

      Coding error detected, it must be fixed by a programmer: Could not load preference popup_provider_moodle_instantmessage__permitted. Does the component and name you supplied to message_send() match a row in message_providers? Message providers must appear in the database so users can configure how they will be notified when they receive messages.

      Show
      In order to test this, you need to replicate an attempt to send message using non-existing component or provider name. For example, you may modify file message/lib.php the way: --- a/message/lib.php +++ b/message/lib.php @@ -2006,7 +2006,7 @@ function message_post_message($userfrom, $userto, $message, $format) { $eventdata = new stdClass(); $eventdata->component = 'moodle'; - $eventdata->name = 'instantmessage'; + $eventdata->name = 'instantmessage_'; $eventdata->userfrom = $userfrom; $eventdata->userto = $userto; Now try to send personal message to another user, upon the click "Send message", you will get coding exception that will contain the preference name causing error: Coding error detected, it must be fixed by a programmer: Could not load preference popup_provider_moodle_instantmessage__permitted. Does the component and name you supplied to message_send() match a row in message_providers? Message providers must appear in the database so users can configure how they will be notified when they receive messages.

    Description

      As per subject line. Use $defaultpreference instead which contains intuitive value.

      Attachments

        Issue Links

          Activity

            People

              kabalin Ruslan Kabalin
              kabalin Ruslan Kabalin
              Dan Poltawski Dan Poltawski
              Sam Hemelryk Sam Hemelryk
              Rajesh Taneja Rajesh Taneja
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                14/May/12