Prevent users from receiving private messages (except from forum staff)

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
LegoFan
Registered User
Posts: 1
Joined: Wed Nov 20, 2024 12:08 pm

Prevent users from receiving private messages (except from forum staff)

Post by LegoFan »

Hi.

I'm looking for a way, hopefully without using an extension (or writing my own) to make it so that users in a given group can't receive PMs from other users (but can receive them from staff)

I know there's the 'can read private messages' permission, but that won't work because it prevents them from reading pms sent by forum staff (mods, admins)

I also know there's a user preference setting for 'Allow users to send me private messages' but the problem with that is it's user configurable. I want this to be something users have no control over.

Is there any way in the default installation to make this possible?
User avatar
Steve
Registered User
Posts: 1549
Joined: Tue Apr 07, 2009 7:48 pm
Location: Co. Durham, England
Name: Steven Clark

Re: Prevent users from receiving private messages (except from forum staff)

Post by Steve »

Check in ucp > private messages > rule folders settings

See if you can change it there.
But I think it's easier to remove the option from the ucp > board preferences >

Allow users to send you private messages: yes no
Note that administrators and moderators will always be able to send you messages

And setting it to no for that group
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺
User avatar
danieltj
Infrastructure Team Member
Infrastructure Team Member
Posts: 601
Joined: Thu May 03, 2018 9:32 pm
Location: United Kingdom
Name: Daniel James

Re: Prevent users from receiving private messages (except from forum staff)

Post by danieltj »

I think what you’re asking for would need an extension. I don’t believe core includes a setting that complex to distinguish between users and moderators for PMs unfortunately.
User avatar
Steve
Registered User
Posts: 1549
Joined: Tue Apr 07, 2009 7:48 pm
Location: Co. Durham, England
Name: Steven Clark

Re: Prevent users from receiving private messages (except from forum staff)

Post by Steve »

It does Daniel, admin and mods can always send pms it's not dependent on the users option set.
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺
User avatar
danieltj
Infrastructure Team Member
Infrastructure Team Member
Posts: 601
Joined: Thu May 03, 2018 9:32 pm
Location: United Kingdom
Name: Daniel James

Re: Prevent users from receiving private messages (except from forum staff)

Post by danieltj »

You need the right permissions to allow the sending of PMs that’s not something that is universally on for users, particularly moderators. A user only need one permission in the moderator permission set to be classed as one (like lock topics). That doesn’t mean they have permission to use PMs. It’s all permission dependant.
User avatar
warmweer
Jr. Extension Validator
Posts: 11849
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: Prevent users from receiving private messages (except from forum staff)

Post by warmweer »

First thing that comes to mind is the important thing is that PMs received should be read.
So how about allowing only forum staff to send PMs.
In that case all PMs come from forum staff so can read PMs can remain YES, can send PMs set to NO, which can be overridden by YES for the forum staff

Or am I overlooking something?

Added: perhaps forum moderators should only be able to send PMs to members who have read/write permissions in the forums they are moderator of. AFAIK, there no native way to enforce that.
Last edited by warmweer on Wed Nov 20, 2024 7:30 pm, edited 1 time in total.
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53563
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Prevent users from receiving private messages (except from forum staff)

Post by Brf »

danieltj wrote: Wed Nov 20, 2024 6:50 pm You need the right permissions to allow the sending of PMs
This question was not about sending PMs. It is about receiving PMs.
The solution presented involves the UCP setting "Allow users to send me PMs". If that is set to "No" and then disabled so the users in question cannot change it, then (according to the label on the setting) only Admins and Moderators can send those users PMs.
User avatar
Steve
Registered User
Posts: 1549
Joined: Tue Apr 07, 2009 7:48 pm
Location: Co. Durham, England
Name: Steven Clark

Re: Prevent users from receiving private messages (except from forum staff)

Post by Steve »

You can control the option using this event found in: includes/ucp/ucp_prefs.php

Code: Select all

				/**
				* Add UCP edit global settings data before they are assigned to the template or submitted
				*
				* To assign data to the template, use $template->assign_vars()
				*
				* @event core.ucp_prefs_personal_data
				* @var	bool	submit		Do we display the form only
				*							or did the user press submit
				* @var	array	data		Array with current ucp options data
				* @var	array	error		Array with list of errors
				* @since 3.1.0-a1
				* @changed 3.1.4-RC1 Added error variable to the event
				*/
				$vars = array('submit', 'data', 'error');
				extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars)));
@ The Chief Medical Officers guideline for men is that: You are safest not to drink regularly more than 14 units per week.
- I drank that today++ :lol: 🍺
User avatar
warmweer
Jr. Extension Validator
Posts: 11849
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: Prevent users from receiving private messages (except from forum staff)

Post by warmweer »

Guys, my post (in this topic) seems to be neglected.

if plain members (not staff) should not be able to send PMs at all ... then my idea works (I tried it ). But If plain users should be allowed to reply to PMs by forum staff, then it's not foolproof (editing the receiver should then be blocked).
However, if sending mails or instant message are allowed, then the whole PM system can be bypassed.

So I suggest that the exact requirements are specified in order to avoid (or at least reduce) entering paths leading to a dead end.
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
LegoFan
Registered User
Posts: 1
Joined: Wed Nov 20, 2024 12:08 pm

Re: Prevent users from receiving private messages (except from forum staff)

Post by LegoFan »

Thankyou all for the replies. I will answer some of them individually below...
Steve wrote: Wed Nov 20, 2024 3:55 pm Check in ucp > private messages > rule folders settings

See if you can change it there.
But I think it's easier to remove the option from the ucp > board preferences >

Allow users to send you private messages: yes no
Note that administrators and moderators will always be able to send you messages

And setting it to no for that group

Thanks for the reply Steve. AFAIK one only has access to that setting for one's own account. A board admin can't set that to be enabled or disabled for a group.

It would work if that were something that could be controlled by staff (1) Make board preferences read only for a certain group. 2) Have the 'users can send me PMs' preference set to 'no' for that group.) but as far as I can work out, it isn't.


Steve wrote: Wed Nov 20, 2024 5:42 pm It does Daniel, admin and mods can always send pms it's not dependent on the users option set.
The question is about reading PMs, not sending them. I want certain users to be uncontactable privately, except by staff. Basically trying to avoid nefarious behaviour from a subset of members we don't trust yet.
warmweer wrote: Wed Nov 20, 2024 7:25 pm First thing that comes to mind is the important thing is that PMs received should be read.
So how about allowing only forum staff to send PMs.
In that case all PMs come from forum staff so can read PMs can remain YES, can send PMs set to NO, which can be overridden by YES for the forum staff

Or am I overlooking something?

Added: perhaps forum moderators should only be able to send PMs to members who have read/write permissions in the forums they are moderator of. AFAIK, there no native way to enforce that.
Thanks warmweer.

Allowing only forum staff to send PMs isn't an option I'm afraid. I need to allow MOST users to send and receive PMs, but not members of a certain group.
danieltj wrote: Wed Nov 20, 2024 5:37 pm I think what you’re asking for would need an extension. I don’t believe core includes a setting that complex to distinguish between users and moderators for PMs unfortunately.
Thanks danieltj. I think you're right about needing an extension. The other answers, which I appreciate, don't quite work for my specific scenario. (Unless I'm missing something. I have morning brain atm)
Last edited by LegoFan on Thu Nov 21, 2024 10:00 am, edited 2 times in total.

Return to “phpBB Custom Coding”