Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5312

The problem in using the send_message in messagelib.php

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 2.7.2
    • Block: Message teacher
    • None
    • Message
    • MOODLE_27_STABLE

      Dear Sir/Madam,
      I have written a code as follows

      <?php

      require_once(dirname(dirname(_FILE_)) . '/lib/messagelib.php');
      $eventdata = new stdClass();
      $eventdata->component = 'mod_quiz'; //your component name
      $eventdata->name = 'submission'; //this is the message name from messages.php
      $eventdata->userfrom = 4;
      $eventdata->userto = 3;
      $eventdata->subject = 'Assigment No.2';
      $eventdata->fullmessage = "This is second assignment to test the message from outside";
      $eventdata->fullmessageformat = FORMAT_PLAIN;
      $eventdata->fullmessagehtml = 'Hello World';
      $eventdata->smallmessage = 'Check Your Assigment';
      $eventdata->notification = 1; //this is only set to 0 for personal messages between users
      events_trigger('message_send', $eventdata);

      ?>

      When run the php file there is no error, no any warning nor any working.

      The objective behind this code is to send a message from a page my own created without being logged in by using just my id and message receiver id. How I can do this. Please guide me in this regard.

            aborrow Anthony Borrow
            nasir.abbas Nasir Abbas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.