Forums | Mahara Community

Developers /
Sending Messages


anonymous profile picture
Account deleted
Posts: 1

12 September 2013, 22:44

We have students abusing the messaging feature within Mahara is there any way to turn this feature off.  If not where would I look to change the code.

Kristina Hoeppner's profile picture
Posts: 4863

13 September 2013, 7:59

Hello Hazel,

Sorry to read that students are abusing the messaging feature. Before turning it off for everyone, is there the possibility to have a conversation about responsible use?

Turning off messaging is not so easy because it doesn't just affect messages between users, but also forum discussions that are sent out as notifications.

Users can prevent others from contacting them by going to their account settings and choosing an appropriate setting under "Messages from other users".

If you do want to prevent any user from contacting others, you could remove that bit of code from the site. Be careful though: The same settings exist when you set up a user manually and thus you would need to ensure that you catch it everywhere.

This would prevent teachers and admins from contacting students though as well. If you do want to allow those to send messages to regular users, you could look into modifying the code so that the staff, institution and site admin roles still have the setting, but not regular users.

Cheers

Kristina

 

Aaron Wells's profile picture
Posts: 896

13 September 2013, 17:35

To expand on what Kristina said, there is a setting under each user's Account Settings page that lets them set whether they can be sent Messages by anyone, only those on their friend list, or by no one at all: http://manual.mahara.org/en/1.7/account/account_settings.html#general-account-options

The easiest way to eliminate messaging altogether, would be to comment out this setting from the account settings page (the code in question is the definition of the $elements['messages'] array in the function general_account_prefs_form_elements() in htdocs/lib/user.php, around line 266.

Then, since you're already patching the htdocs/lib/user.php file, you could go to the function "expected_account_preferences()", which sets the default value of each user account preference. In that function, change the default value of 'messages' from 'allow' to 'nobody' (this'll be around line 210).

And lastly, delete the existing messaging preferences for all users, so they will fall to the new default of 'nobody'. You can do that by executing this SQL query in your database:

DELETE FROM usr_account_preference WHERE field='message';

Just be careful with patching core code, because you'll have to apply the same patch each time you upgrade Mahara.

Cheers,

Aaron

3 results