Forums | Mahara Community

Support /
Turning off messaging system


anonymous profile picture
Account deleted
Posts: 8

25 May 2010, 14:26

I can't seem to find a way to turn off messaging in 1.2... Is there any workaround for this? I'm in K-12 and it is a real dealbreaker for us. Any help would be great!

Craig Eves's profile picture
Posts: 104

25 May 2010, 17:42

Hi John

Each user can choose whether or not they can be sent messages  -

Settings > Preferences > messages from others

There is also an option to get messages sent to a log or emailed to you

Settings > Activity preferences

Are you wanting to do this at a site level ? The default is to send messages and there doesn't seem to be an option to change this at a site level through the menu settings.  This may need to be done by changing some of the program code settings.

regards

Craig

 

anonymous profile picture
Account deleted
Posts: 8

26 May 2010, 5:54

Yes, I need to do this at the site level. I don't mind modding the code, any ideas where to start?

anonymous profile picture
Account deleted
Posts: 808

26 May 2010, 17:34

Hi,

The first thing to do is create a new config option - the quick way is to add something like "$cfg->disablemessaging =  true;" to your config.php file.  You will then be able to check the value of this anywhere in the code with a call to get_config('disablemessaging')

Then in lib/user.php, modify the send_user_message and can_send_message functions to ignore the user 'messages' preference and disallow messaging if get_config('disablemessaging') is true.

Further down in that file in the get_users_data function, you'll see that the 'messages' user account preference is queried directly in the sql (for the find friends/my friends user listings).  It's probably easiest to leave that query as it is but override the user preference in the loop straight after the query, in the line where $record->messages is updated.

Finally to avoid user frustration you should modify the Settings -> Preferences page (account/index.php), and leave out the "Messages from other users" option if messaging is disabled at the site level.  Otherwise you'll be giving people false hope.

If you do all that, send us a patch and we'll include it in Mahara 1.3!

anonymous profile picture
Account deleted
Posts: 8

27 May 2010, 12:38

Thanks! It works great. Here is a url to a zip with the files for anyone else that needs it:

A link

 

anonymous profile picture
Account deleted
Posts: 8

14 September 2010, 6:40

Hi,

I understand that a workaround has been created and uploaded for 1.2 (great work btw), what are the chances of this being incorporated into mahara 1.3?

 

Or do we need to hack the code after upgrading to 1.3?

 

Husman

6 results