Student-Teacher Messaging

Student-Teacher Messaging

by Riccardo Sciscio' -
Number of replies: 30

Hello to you all,


I've got an issue I'm still not able to fix and I cannot find recent resources and posts about this topic (sorry for reposting if I missed them).


I've got groups with students and teachers and I would like to allow the teacher-student messaging, but prevent students to message other students.

I've already disabled messaging for the authenticated user and created a new role in order to allow teachers to message students, but this way students are not allowed to reply to the teacher.


I partially solved this with the Message My Teacher block so students can send messages to teachers, but they still can't answer directly from the messages page. They always have to pass through the block not being able to properly follow the conversation.


Any suggestions on how to sove this?


Thank you very much.

Average of ratings: Useful (1)
In reply to Riccardo Sciscio'

Re: Student-Teacher Messaging

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Might the Dialogue module help... https://moodle.org/plugins/mod_dialogue ??

Average of ratings: Useful (1)
In reply to Howard Miller

Re: Student-Teacher Messaging

by Riccardo Sciscio' -

Hi Howard,

Thank you for answering.

Unfortunately the Dialogue Module allows students to message other students enrolled in the same group. I would still have this issue to fix.


Thanks anyway!

In reply to Riccardo Sciscio'

Re: Student-Teacher Messaging

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

 I would still have this issue to fix. That's an easy fix. I have Dialogue set up with the Student role removed from, Receive, who can be the recipient when opening a conversation. (mod/dialogue:receive) That makes it so students can open a conversation ONLY with whoever else you have left for that permission setting, plus admins. In my case, I have a created role of Facilitator, plus non-eding teacher and teacher left for that permission. Works great.

I even use PoodLL Anywhere for Atto to send and receive audio and video messages in a dialogue conversation. To me, making an audio recording via a smart phone is easier than using their tiny keyboards to type anything more than one sentence. NOTE: the current version of PoodLL does cost money, but there are also other recording plugins that work just as well.

Average of ratings: Useful (1)
In reply to AL Rachels

Re: Student-Teacher Messaging

by Riccardo Sciscio' -

Thank you AL Rachel for your answer!

Unfortunately, this hack is only a partial solution. By doing so, students are indeed not allowed to open conversations with other students, but at the same time, because of the exclusion of the student role from the recipient list, teachers have no chance to open a new conversation with students either. They can only answer if the students has opened a conversation. It's still a one-way-communication.

For me the perfect system would be:

Teachers can message only users in the same group (regardless of role), not other users system wide (like a class with several students and teachers);

Students cannot message any other user with the student role (learning platform is not a chatting website);

Students can message only other users in the same group (except other students, obviously), this means only their class teachers and not others.


Still can't figure out how to do so...


In any case, thanks again for your help!

In reply to Riccardo Sciscio'

Re: Student-Teacher Messaging

by Ken Task -
Picture of Particularly helpful Moodlers

Suggest you check out some addons ... that might come close to what you want:

https://moodle.org/plugins/local_mail

https://moodle.org/plugins/?q=mail

https://moodle.org/plugins/index.php?q=messages

'spirit of sharing', Ken

In reply to Riccardo Sciscio'

Re: Student-Teacher Messaging

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Sorry Riccardo,

On my production site, I do have it working exactly the way you want it too, but on a more recent dev site it is working the way you discovered. I have spent some time looking and just can't seem to find out what I did to make one work that way and the other one not.

Just realized why the above situation might be the way it is. My production site started out as an early version of Moodle with whatever version of dialogue was available at the time and both have been upgraded as upgrades became available. Back then the type of dialogue could be set to Teacher-Student, Student-Student, Everyone (these modify the permissions). These were legacy options pre-2.5x. I know I had mine set on Teacher-Student and "under the hood" as the old saying goes, it must be still working that way.

Makes me wonder if it would be possible to install an old version, set it that way, then upgrade it?

Hmm...in the background over the past few days, I have been migrating some of my old Moodle installs from an old server onto an Odroid XU4. (only one moving part) Just went and checked and sure enough Dialogue 2.4 had those three settings. The legacy setting for them was there for Dialogue 2.5 and 2.6, then dropped.

In reply to AL Rachels

Re: Student-Teacher Messaging

by Riccardo Sciscio' -

Thanks for the update!

I'll see if I can solve this with a previous version of Dialogue.

In reply to Riccardo Sciscio'

Re: Student-Teacher Messaging

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Riccardo,

Unfortunately, I don't expect it to work. I actually tried to reproduce another copy like you want by installing version 2.4 and then updating...did not work. The only thing I can figure is that I probably made some changes to Dialogue that makes that one copy work like that. I probably did it at school and with students in the room, did not take time to make notes. At least I have not found any.

In reply to AL Rachels

Re: Student-Teacher Messaging

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Eureka! I finally figured out what I have done on the production site to make it so students can only open a Dialogue with non-editing teachers, teachers, managers, and admins. This might not be a suitable solution for you as I have only one copy of Dialogue installed, and it is on the front page of the site.

Since my production Moodle has always been very small, this works, but might not be suitable for a large site. Might be able to adapt it to Dialogue installed in a course, just depends on how you set up groups.

  1. Install Dialogue on the front page in the Main Menu Block with a checkmark for Use course groups.
  2. In the front page Administration > Users > Permissions Assigned Roles added myself and two other teachers in the Teacher role. Added Non-editing teacher to Non-editing teacher role. Added manager to Manager role. Added ALL the students to the Student role.
  3. In the front page Administration > Users > Groups > Auto-create Groups. Auto create based on Memebers per group. Group/member count > 1. Select members with role > Student.

With this setup, students can open a dialogue only with people in the role of teacher or non-editing teacher. Hope this helps.

In reply to AL Rachels

Re: Student-Teacher Messaging

by Riccardo Sciscio' -

Hi AL!

Again, thank you very much for your help and support.

If I understand right, with this method I would create a group for every single student, right? Unfortunately I'm already using groups for course enrollment and this way I would end up with hundreds of groups (up to thousand) and it would be very hard to manage.

In any case, maybe I'll give it a try.

Thank you so much!

In reply to Riccardo Sciscio'

Re: Student-Teacher Messaging

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Riccardo,

Hope it works for you. It is a real shame the developer dropped that teacher to student setting as the "need" for it seems to come up multiple times each year. Maybe you could put in a request for it with the developer.

In reply to AL Rachels

Re: Student-Teacher Messaging

by Riccardo Sciscio' -

Hi AL,


At the end I've set up single-student-groups and I'm using Dialogue for student-teacher communication.

Know I have a new question you might be able to answer: do you know how to edit the notification email users recieve when someone writes them through the Dialogue module? I can't find anything in the language pack.

Any suggestions?


Thank you very much for your help!

In reply to Riccardo Sciscio'

Re: Student-Teacher Messaging

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Riccardo,

By language pack, do you mean the language file that comes with Dialogue? Or do you mean the Italian language pack?

Could you post the text of that email? That would help me find it's location and how to change it.

In reply to AL Rachels

Re: Student-Teacher Messaging

by Riccardo Sciscio' -

Hi AL,

I was lookin in the italian language pack (where you can modify moodle's mail texts).

Wherever a user writes me using the Dialogue module, I recieve an email like this:


From: #NameOfUser# (via Home)

Content: #NameOfUser# posted a new message to a conversation you are partecipating in with subject: #subject#. View in Moodle.

 Do you know where I can find the strings and modify them?


Thanks a lot!

In reply to Riccardo Sciscio'

Re: Student-Teacher Messaging

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Riccardo,

That text is in yourmoodle/mod/dialogue/lang/en/dialogue.php, but it would be best if you use Language customization to change it.

Go to Site administration > Language > Language customization. Then choose, English (en), from the drop down. Open language pack for editing then Continue.

Under Filter strings, in the Show strings of these components, in the mod section, select dialogue.php. In the, Only strings containing box, enter, posted a new message, then click Show strings.

That should give you two strings, messageapibasicmessage and messageapismallmessage. I believe it is the 'basic' one you want to change and not the 'small' one. Copy and paste what is already there into the Local customization text area and make your changes. Be careful with all the HTML and $a variables as they control the automatic text part of the email.

If you make the changes this way, they will be there each time you upgrade the Dialogue activity. If you go make the changes directly in the yourmoodle/mod/dialogue/lang/en/dialogue.php file, your changes will be lost the first time you upgrade Dialogue.

In reply to AL Rachels

Re: Student-Teacher Messaging

by Riccardo Sciscio' -

Hi AL,


THANK YOU SO MUCH! Your help is like gold.

Now it works perfectly. Just one last tiny detail: in the notification email, the name of the user who sent the message is dislplayed like this: #FirstName# #LastName# (via Home).

Any idea on how to get rid or customize the (via Home) part. I can't find the corresponding string in the dialogue.php file (in moodle's customization).

Here's a screenshot:







Thanks again for your patience and support!

In reply to Riccardo Sciscio'

Re: Student-Teacher Messaging

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Riccardo,

Glad to hear almost everything is now working the way you want it to. Unfortunately, due to the age of my students, school policies, and the way I had to set my Moodle server up, I never used any Moodle email capabilities, so I can´t reproduce that part to know what string to search for.

Could that possibly be your site email no reply entry. Site administration > Server > Email > Outgoing mail configuration.


In reply to Riccardo Sciscio'

Re: Student-Teacher Messaging

by Kim Salinas -
Picture of Testers

Hi Riccardo

I have disabled Messaging as well. To have the private teacher-student interaction, I create a General Forum in my courses called my Virtual Office and set it to Separate groups. I then put each student in their own 1 member group. This will allow me to have private communication between myself (teacher) and each learner. 

Happy Moodling

In reply to Kim Salinas

Re: Student-Teacher Messaging

by Riccardo Sciscio' -

Hi Kim,

Thanks for the answer.

Unfortunately I already use separate groups to organize student-teacher enrollment, I would end up with a lot of nested groups and it would be unpractical. In any case, I have too many students, I would have to create hundreds (up to thousand) of individual groups.


Thanks anyway!

In reply to Riccardo Sciscio'

Moodle 3.5 - Student-Teacher Messaging Hack

by Sam Mudle -

Ok, I think I have a good simple hack to limit the built in messaging system to just between students and teachers.

STEP 1: Remove the SEND MESSAGE and ADD CONTACT buttons for students, but keep it enabled for admins.

/lib/outputrenderers.php

In the function context_header look for these lines:

           $imagedata = $this->user_picture($user, array('size' => 100));
if (!empty($CFG->messaging) && $USER->id != $user->id && has_capability('moodle/site:sendmessage', $context)) {
$iscontact = !empty(message_get_contact($user->id));

Change to:

           $imagedata = $this->user_picture($user, array('size' => 100));
$showit = has_capability('moodle/site:config', $context); //hack
if (!empty($CFG->messaging) && $USER->id != $user->id && has_capability('moodle/site:sendmessage', $context) && $showit) {
$iscontact = !empty(message_get_contact($user->id));

STEP 2: Now we need to stop students from searching for any users besides admins and teachers, BUT still allow admins and teachers to search for any user to message.

In the file /message/classes/api.php

go to the bottom of the function search_users and look for:

            foreach ($users as $user) 
            {
                  $noncontacts[] = helper::create_contact($user);
            }

and change it to:

            global $USER; //add this line
            foreach ($users as $user)
            {
                //Restrict students from searching for anyone besides teachers.
                //Allow teachers to search for anyone.
                if (has_capability('moodle/course:manageactivities', \context_system::instance(), $user)
                 || has_capability('moodle/course:manageactivities', \context_system::instance(), $USER))

                {
                  $noncontacts[] = helper::create_contact($user);
                }
            } //end for each

Comments:

The permission moodle/site:config might be too restrictive for teachers, let me know your thoughts.   I was worried that students could block teacher's messages, but I've tested, and while they can click the BLOCK CONTACT link, the messages still go through - so no hacks needed to the message javascripts.

I'm subscribed to this, so if you post a reply I'll get a notification.



Average of ratings: Useful (1)
In reply to Sam Mudle

Re: Moodle 3.5 - Student-Teacher Messaging Hack

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Well apart from the facts that a lot of Admins don't actually get to look at core, for whatever reason, or don't have the skill set to code, or they d not get time to code, this could be a tidy hack. Unfortunately, as this is core, it becomes seriously problematic as a Moodle moves through the update cycle. Might go many versions, then it no longer works, or the Moodle breaks when trying to send a message. Or the Admin who is hacking the code moves to another position and I know from personal experience a lot of Admins don't bother to document their changes, so who knows what is hacked? Who does the hack then? 

Best Bet, raise this as a new feature, the ability to turn off student-student messaging retaining Teacher-Student or Student-Teacher messaging, in Moodle Tracker

In reply to Colin Fraser

Re: Moodle 3.5 - Student-Teacher Messaging Hack

by Sam Mudle -

Best Bet, raise this as a new feature, the ability to turn off student-student messaging retaining Teacher-Student or Student-Teacher messaging, in Moodle Tracker

Done.  So we can do this while waiting three years for the request to be approved.  smile

In reply to Sam Mudle

Re: Moodle 3.5 - Student-Teacher Messaging Hack

by Mark Fischer -

Would you please post the ticket number or a link to the ticket.  This is an important feature for us and I want to follow the request.

In reply to Sam Mudle

Re: Moodle 3.5 - Student-Teacher Messaging Hack

by Greg Lind -

Thank you, S Moodle.

I used the old hack method for years but it stopped working after the 3.2 update and I didn't have the time/skill to figure out another solution before my classes started.

I understand the reasons Colin might not use it himself nor allow it in his organization, and I think it's productive that someone publishes the caveats.

However, I manage my own servers and this is the kind of solution people in my situation are looking for. I'll implement it and report back. This is a great thread for people who need/want more control over messaging features. 

Student-to-student messaging can be a major problem in high school classes. This has been a problem for years, and it's among the reasons that high school teachers abandon Moodle. I'm glad you posted it as a feature request but IMO that will never happen. It's just not a priority. BTW I'm fine with that--not complaining. I think that's why these kind of use-at-your-own-risk hacks are necessary for some users.

With the old hack, the changes were overwritten each time you did an update and you had to reapply the hack. I thought of automating with a script, but worried that there would be subtle changes in the code eventually, and that my script would muck things up. For this reason I did the updates manually. I imagine your hack will be similar, from the looks of it. Not a big deal from where I sit.

P.S. My site is down for the summer so I won't be able to test this with students until September, 2018.


Best,

Greg

Average of ratings: Useful (1)
In reply to Greg Lind

Re: Moodle 3.5 - Student-Teacher Messaging Hack

by Sam Mudle -

Greg,

This line is better for removing the SEND MESSAGE button:

                $showit = has_capability('moodle/site:readallmessages', $context) || has_capability('moodle/site:readallmessages', $context, $user->id);

The previous hack was too restrictive.  This will show the button if the logged in user is a teacher or manager.  It will hide the button if the logged in user is a student, and is looking at another student's profile.

The only other hack i did was to remove the BLOCK CONTACT button so students could not block teacher messages.  I just replaced the language string with ''


In reply to Sam Mudle

Re: Moodle 3.5 - Student-Teacher Messaging Hack

by Madhu Avasarala -

Hello Greg,

Thank you for your post suggesting ways to restrict student-student messaging-Something I am struggling with.

This does nothing to prevent messaging using the Mobile App, correct? Are you not concerned about that?

In reply to Greg Lind

Re: Moodle 3.5 - Student-Teacher Messaging Hack

by Greg Lind -

I updated to Moodle 3.5.1+ (Build: 20180824) and applied the hack with the better line for removing the SEND MESSAGE button. Everything is in place and the site is working. I'll report back once school starts. My first day of class is September 5.

As a follow up to something I (and perhaps others) said earlier, this is easy to apply. Of course, you must have access to the server or a way to ssh to the files in the moodle root directory, and you must be comfortable editing the files. Other than that, just save the changes. No need to restart a service or reboot. Piece of cake. If this works as expected, I'll happily make this edit each time I update.

Caveat: I update manually and usually only once a semester unless there's a major security fix. If I updated more often it might become cumbersome to copy and paste these files every few weeks. Still, in my classroom the benefit to productivity is probably worth the little bit of time it takes.

In reply to Sam Mudle

Re: Moodle 3.5 - Student-Teacher Messaging Hack

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

But what happens at the site level? If I am in the messaging at site level rather than inside a course; what role will I have then?

In reply to Jon Witts

Re: Moodle 3.5 - Student-Teacher Messaging Hack

by Sam Mudle -

But what happens at the site level? If I am in the messaging at site level rather than inside a course; what role will I have then?

I ban all messaging outside the course.  I don't want students messaging other students.