From c657732d1b42b666d135b3e6a6564e639584aca7 Mon Sep 17 00:00:00 2001
From: Dasuntha Gunathunga <Dasuntha.Gunathunga@navitas.com>
Date: Mon, 30 Oct 2017 12:34:00 +1100
Subject: [PATCH] #121 - Added instructor email and user email into translator

---
 lib/emitter/src/Events/EnrolmentCreated.php    | 3 ++-
 lib/translator/src/Events/EnrolmentCreated.php | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/emitter/src/Events/EnrolmentCreated.php b/lib/emitter/src/Events/EnrolmentCreated.php
index 1238d07..dbcb876 100644
--- a/lib/emitter/src/Events/EnrolmentCreated.php
+++ b/lib/emitter/src/Events/EnrolmentCreated.php
@@ -37,8 +37,9 @@ class EnrolmentCreated extends Event {
             ],
             'object' => $this->read_course($opts),
             'context' => [
-                'instructor' => parent::read($opts)['actor'],
+            	'instructor' => $this->read_user($opts, 'instructor'),
             ],
         ]);
+        
     }
 }
diff --git a/lib/translator/src/Events/EnrolmentCreated.php b/lib/translator/src/Events/EnrolmentCreated.php
index ea9c764..1c97e7e 100644
--- a/lib/translator/src/Events/EnrolmentCreated.php
+++ b/lib/translator/src/Events/EnrolmentCreated.php
@@ -31,8 +31,10 @@ class EnrolmentCreated extends CourseViewed {
             'user_id' => $opts['relateduser']->id,
             'user_url' => $opts['relateduser']->url,
             'user_name' => $opts['relateduser']->fullname,
+            'user_email' => $opts['relateduser']->email,
             'instructor_id' => $opts['user']->id,
             'instructor_url' => $opts['user']->url,
+            'instructor_email' => $opts['user']->email,
             'instructor_name' => $opts['user']->fullname,
         ])];
     }
-- 
GitLab