Two quick questions with, I hope, quick answers. Haven't found either on the issue queue. First post, apologies if my syntax is newbie-ish.

1. The Private Messages module adds a "Messages" link to Navigation, which links to "base_path/messages" and works just fine. There is also a link "Messages" added to the User Profile tab which links to "base_path/user/$uid/messages" and which gives a page with "No pending messages," even when there are viable pending messages (shown in Navigation link, in fact). Have I made a mistake in my settings, or is there a way to redirect this tab link appropriately? Or has this tab link been created by another module, in which case...never mind...too many new installs...

2. Is there any way to shut down the "Send this user a message" link when user is viewing their own profile page?

This is very minor stuff in a very impressive module, but they are head-scratchers.

Comments

berdir’s picture

Version: » 6.x-1.x-dev

First, do not use the 2.x version, use 1.x-dev or 1.0-rc3.

There is also a link "Messages" added to the User Profile tab which links to "base_path/user/$uid/messages" and which gives a page with "No pending messages," even when there are viable pending messages (shown in Navigation link, in fact). Have I made a mistake in my settings, or is there a way to redirect this tab link appropriately? Or has this tab link been created by another module, in which case...never mind...too many new installs...

Hm, is it possible that this is from the messaging module? Privatemsg does not yet have such a thing...

2. Is there any way to shut down the "Send this user a message" link when user is viewing their own profile page?

You can remove it with hook_user in a custom module with a higher weight than privatemsg, but that is not a nice solution. It should be easy to fix this, I already did it in a patch once, but litwol requested to remove it from that patch. (that does not mean he is against removing it, just that we/he didn't wanted to change how it works in a patch that just refactored internal functions).

drupup’s picture

1. Ah, it was Simple Messaging that created the tab. Module overload! So I guess this falls under the FYI category....it's possible for a user to have two different links saying "Messages" that go to different places, if the site designer isn't careful about which module boxes he checks.

2. Perhaps make this something you can turn on/off with a checkbox in settings? I can see both why you would and wouldn't want this feature available. Pick one or the other and some people will be dissatisfied.

Thanks for the response. Overall, this module is just outstanding. If I can figure out Rules well enough, and figure out how to integrate private messaging into Rules, this will be a great way to keep users up to date on their site use without bombarding them with e-mails.

berdir’s picture

Issue tags: +Novice

2. Perhaps make this something you can turn on/off with a checkbox in settings? I can see both why you would and wouldn't want this feature available. Pick one or the other and some people will be dissatisfied.

Should be easy to add, but I don't have time to write a patch at the moment. If you (or someone else who whants the feature) know a bit PHP, feel free to do so, you only have to add three things:

1. Add a setting to the admin form, you can pretty much copy paste an existing option and change the name, description and so on.

2. Add an additional check in http://blog.worldempire.ch/api/function/privatemsg_get_link inside the foreach, should look like:

if (variable_get('your_variable_name', FALSE) && $recipient->uid == $author->uid) {
  continue;
}

3. remove the variable in privatemsg_uninstall().

berdir’s picture

Status: Active » Needs review
StatusFileSize
new4.25 KB

Implemented what I described above...

I also tried to clean up our settings page a bit, any feedback is welcome ;) I even thought about hiding the currently useless template setting, not sure...

drupup’s picture

I was about to say it hadn't worked...then I realized you put it in the setting panel as a checkbox. I'm glad I looked one more time! I can see there are situations where peopel would want the function, so a checkable choice is best.

Yeah, there's no way I would have been able to put that code together, I'm just not at that level of Drupalicity yet.

I agree...the "default view" radio button doesn't serve much purpose, beyond that the settings panels are marvelously uncluttered. This is just a very well-executed module all around.

berdir’s picture

Title: Message Link in Account Tab and Private Message to self » Private Message to self and re-organizing admin/settings/messages
StatusFileSize
new42.06 KB

Updating title and adding a screenshot of the updated admin screen. The List fieldset is collapsed by default.

Plazmus’s picture

I don't see the point keeping as option 'Display "Send this user a message" links for themself' for me it's quite obvious that anyone will not send messages to themselves, will you ?

litwol’s picture

That is a big and baseless assumption. that feature exist because it was explicitly requested by those people that desire to send messages to themselves.

Plazmus’s picture

Not having this link in own profile is more "natural", just have a look at Facebook or any other website (at least all that I know) don't have it and if people wants to send message to themselves can always go to 'messages/new'.

However if there is someone who will need this functionality let's keep it.

I tested this patch for a while and works as expected.

berdir’s picture

Title: Private Message to self and re-organizing admin/settings/messages » Option to configure the display of the send message to themself link.
Version: 6.x-1.x-dev »
StatusFileSize
new2.86 KB

Re-rolled, removed admin form cleanup stuff. Patch only applies against 2.x-dev.

berdir’s picture

StatusFileSize
new2.94 KB

New patch moves the setting into the new fieldset, no other changes, will commit this soon.

berdir’s picture

Version: » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

Commited to 6.x-2.x, needs to be ported to 7.x-1.x.

berdir’s picture

Version: 7.x-1.x-dev »
Status: Patch (to be ported) » Needs review
StatusFileSize
new930 bytes

Ported and Commited to 7.x but I found a bug in the patch while porting which is already fix in 7.x but not yet in 6.x-2.x. Because of missing brackets, $url is empty. The attached patch fixes that, I'm going to commit that now.

berdir’s picture

Status: Needs review » Fixed

Commited.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

boran’s picture

Component: User interface » Code

If would be nice to have a stable release with these fixes...
I'm reluctant to use (yet another :-) dev release in production... I need to hide the "Send this user a message" on one's own profile.
The quickest way was in privatemsg_user() to change:
if ($url = privatemsg_get_link(array($account))) {
to
if ($url = privatemsg_get_link(array($account)) && ($user->uid != $account->uid)) {