Closed (fixed)
Project:
Privatemsg
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Nov 2004 at 05:15 UTC
Updated:
16 Dec 2004 at 08:15 UTC
Jump to comment: Most recent file
Some prominent or controversial users within a site might not want to receive private messages. They should beable to opt out via the user profile page.
I intend to begin coding this soon unless someone beats me to it.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | privatemsg_0.patch | 4.96 KB | moshe weitzman |
Comments
Comment #1
TDobes commentedSounds like a good idea. Please keep private messages enabled by default, though.
Comment #2
moshe weitzman commentedAs promised, here is the patch. If acceptable, please consider applying to 4.5 as well.
Comment #3
TDobes commentedSorry for the delay in responding.
I have committed a modified version of this patch. Changes include:
* Hide the "view inbox" menu item when private messages are disabled.
* Changed the logic so private messages are enabled by default (also made mail alerts enabled by default; this should not affect current users).
* Removed the check of privatemsg_allow for in the _link hook. The $arg that is passed is a node object, not a user object. We'd have to use user_load to obtain the user object, which would add several db_queries on multi-node pages... I'm not sure it's worth it.
* Removed the logic in the _user hook that checked the value for $edit. Correct me if I'm wrong, but won't $edit only differ from $user if we've failed the validation step for some reason and been returned to the same form? I don't see any other modules that do a check like this, but maybe I'm just not looking closely enough. Feel free to dispute this.
Thanks for your work!
Comment #4
moshe weitzman commentedThanks for the review. A few notes:
- I was allowing disabled users to vie their inbox in case they have old messages there, or wish to send a message (but they can't receive a reply). These are marginal cases, so it may makesense to disable as you've suggested
- the node object that is pased in _link hook has info about the author in it. Specifically, it has the user's picture, and everything in the data column. See node_load(). Since this pref is stored in the data column, its present in $node. I suggest accepting this part of the patch.
- that correct that edit differs when there has been a validation error. In the case of a validation error (which could be thrown by any module for unrelated data), we want avoid 'forgetting' the posted data. Thats why we use $edit if it exists. If not, we fall back on values from the DB (i,e the $user object). This is a common practice in Drupal, but not as common as it should be.
Comment #5
TDobes commentedI would like to avoid displaying the inbox menu item when users have turned off their ability to accept messages. Perhaps I could leave it accessable by changing the menu item type of MENU_CALLBACK for users who've disabled private messages?
You are correct; I should have checked node.module. For some reason, this code didn't work when I tested it, though... perhaps an error on my part. I'll give it another try and see if I can figure out what happened.
OK, agreed. I will commit this part of the patch later today. I suppose I should look through the other modules I use and see whether they do this.
Comment #6
TDobes commentedOK... I committed the changes I mentioned in the last comment. (to both the 4.5 and HEAD branch)
Thanks, Moshe!
Comment #7
(not verified) commented