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

Messaging: Allow for personalization of message by using ##field## similar to database or [[filtertext]]

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.9.5, 2.0.3
    • Fix Version/s: DEV backlog
    • Component/s: Messages
    • Labels:
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      On a site migration, we wanted to send out a message to all users indicating their username. I realized there is currently no way that I could think of to send a message like:

      Dear ##firstname##,

      Welcome to the new site. Your username is ##username##. You can find the new site at http://newsite.com/.

      The goal would be that the ##firstname## and ##username## would get replaced with that individual user's firstname, lastname, or username as specified. This would not be too difficult to do. The name fields would need to be added (firstname, lastname, and username) to the query which would increase the amount of memory and may impact large groups. Otherwise the replacements could be done in /admin/user/user_bulk_message.php.

      if ($confirm and !empty($msg) and confirm_sesskey()) {
      $in = implode(',', $SESSION->bulk_users);
      if ($rs = get_recordset_select('user', "id IN ($in)")) {
      while ($user = rs_fetch_next_record($rs))

      { // this would be a good place for a search and replace on a template like ##username##, ##firstname##, ##lastname## message_post_message($USER, $user, $msg, FORMAT_HTML, 'direct'); }

      }
      redirect($return);
      }

      For now I am just going to handle this with a manual query adding the records to the message table but it would be nice to add some personalization to the bulk messaging. I am not sure how this might relate to the improved messaging system being worked on for Moodle 2.0.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  9 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated: