• Skip to secondary menu
  • Skip to main content
  • Skip to primary sidebar

Question2Answer

Question2Answer Tips, Plugins and Themes

  • Home
  • Plugins
  • Themes
  • Demo v1.8
  • Q2A Hosting
  • Q2A Testing Team
  • Sites
  • Meta Q2A

How to Disable Private Messages between Users and Keep for Admins

There are advantages and disadvantages of enabling privates messages between users. Some SPAM user can register and send messages to random user, there is limit of sending message but still it can be exploited. If you want to disable private messages between users and keep it for admins then you can do below core hack.

Modify file /qa-include/pages/user-profile.php Line no: 394

from

	
// Private message link

	if (qa_opt('allow_private_messages') && isset($loginuserid) && $loginuserid != $userid && !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES) && !$userediting) {
		$qa_content['form_profile']['fields']['level']['value'] .= strtr(qa_lang_html('profile/send_private_message'), array(
			'^1' => '<a href="' . qa_path_html('message/' . $handle) . '">',
			'^2' => '</a>',
		));
	}

to

// Private message link

if ( qa_get_logged_in_level() >= QA_USER_LEVEL_SUPER ) { 


	if (qa_opt('allow_private_messages') && isset($loginuserid) && $loginuserid != $userid && !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES) && !$userediting) {
		$qa_content['form_profile']['fields']['level']['value'] .= strtr(qa_lang_html('profile/send_private_message'), array(
			'^1' => '<a href="' . qa_path_html('message/' . $handle) . '">',
			'^2' => '</a>',
		));
	}

}

You can change user level to any of these user types

QA_USER_LEVEL_EXPERT
QA_USER_LEVEL_EDITOR
QA_USER_LEVEL_MODERATOR
QA_USER_LEVEL_ADMIN
QA_USER_LEVEL_SUPER

Filed Under: How-to, Q2A Core, Q2A Core Hack

Love Question2Answer? Join testing team

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Question2Answer.org (official site) is a free and open source php/MySql platform for Q&A sites.
Download Q2A (v1.7.5 stable)

About Q2A.info

This site is a collection of Plugins and Themes for Question2Answer platform.

Get Plugin/Theme updates

Demo

Q2A v1.8 (Github)
Plugins Demo Site

Plugin Authors

  • Amiya Sahu
  • Arjun Suresh
  • donShakespeare
  • Gabriel Zanetti
  • Gurjyot
  • NoahY
  • ProThoughts
  • Q2A Market
  • q2apro.com
  • Scott
  • Copyright © 2022 · Lifestyle Pro on Genesis Framework · WordPress · Log in