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
105 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

+1 vote
answered 1 day ago by bluegenel
edited 1 day ago by bluegenel
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 5 hours ago by Zeeshan
perfect it is working too. thanks..
commented 5 hours ago by bluegenel
No problem. Glad it is working for you.
...