Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

disable private message for users and keep it enable for admin

+5 votes
172 views
asked Aug 30, 2017 in Q2A Core by john123
Is there anyway to disable private messages between users but keep it enable for admin?

as admin i want to send private messages to my users and i don't want users to send private messages to each other.

It seems that disabling private message disables messages for admin also.
Q2A version: latest

1 Answer

+4 votes
answered Jan 18 by bluegenel
selected Jan 19 by john123
 
Best answer
You can hack the core as follows:

in qa-include/pages/message.php

change this at line 52..

if ($handle === $fromhandle) {
// prevent users sending messages to themselves
$qa_content['error'] = qa_lang_html('users/no_permission');
return $qa_content;
}

to this...

// prevent users sending messages to themselves or user is not equal to admin
if ($handle === $fromhandle || $fromhandle != 'admin user name goes here') {
$qa_content['error'] = qa_lang_html('users/no_permission');
return $qa_content;
}
commented Jan 19 by john123
Thank you for your help #bluegenel. I appreciate it. :)
commented Jan 19 by bluegenel
No problem John. Glad to help.
...