Closed (fixed)
Project:
Privatemsg
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Mar 2011 at 14:07 UTC
Updated:
7 Apr 2011 at 12:51 UTC
Jump to comment: Most recent file
Comments
Comment #1
berdirThis should work. Works for me in my dev site and we have tests for this.
- Do you have a special url prefix configured?
- Other modules which integrate with Privatemsg?
- How do you access the messages of another user?
Edit: the tags field is to group similar issues together and add special meaning to them with pre-defined tags. No need to add random tags to it.
Comment #2
marktheshark commentedThought tags were meant for keywords... My bad, I guess.
To answer your questions:
Comment #3
marktheshark commentedChanging to active after providing more info.
Comment #4
marktheshark commentedSorry for bumping, but is there any feedback on this?
The user admin of our site currently cannot access any private messages (unless I am mistaken about the path where the admin should access them, i.e. the user's main 'messages' page)...
Thanks once more
Comment #5
berdirWell, I simply do not know. As I said, I verified that it works for me and we have tests for this which work fine too.
About the prefix, I meant not your site but the url prefix privatemsg configuration setting (defaults to "messages")
You likely need to start debugging this.
Start by adding a "dpm($query);" to the function "privatemsg_list" after it's created (line looks like "$query = _privatemsg_assemble_query('list', $account, $argument);"). Does the query look correct? Is it using the correct user id? If unsure, post the query here.
You can also try to execute the query with phpmyadmin, remember to remove the curly braces around table names.
Comment #6
marktheshark commentedThis is the query for user with uid 23 when looking at their own messages:
SELECT pmi.thread_id, MIN(pm.subject) as subject, MAX(pm.timestamp) as last_updated, SUM(pmi.is_new) as is_new, (SELECT GROUP_CONCAT(DISTINCT CONCAT(pmia.type, '_', pmia.recipient) SEPARATOR ',') FROM {pm_index} pmia WHERE pmia.type = 'user' AND pmia.thread_id = pmi.thread_id AND pmia.recipient <> 23) AS participants FROM {pm_message} pm INNER JOIN {pm_index} pmi ON pm.mid = pmi.mid WHERE (pmi.recipient = 23 AND pmi.type IN ('user', 'hidden')) AND (pmi.deleted = 0) GROUP BY pmi.thread_id ORDER BY last_updated DESCUser 23, in this example, has one active conversation thread, and this gets displayed correctly.
This is the query for user with uid 18 which has the "read all messages" permission, when they tries to see user 23's messages (path: user/23/messages):
SELECT pmi.thread_id, MIN(pm.subject) as subject, MAX(pm.timestamp) as last_updated, SUM(pmi.is_new) as is_new, (SELECT GROUP_CONCAT(DISTINCT CONCAT(pmia.type, '_', pmia.recipient) SEPARATOR ',') FROM {pm_index} pmia WHERE pmia.type = 'user' AND pmia.thread_id = pmi.thread_id AND pmia.recipient <> 18) AS participants FROM {pm_message} pm INNER JOIN {pm_index} pmi ON pm.mid = pmi.mid WHERE (pmi.recipient = 18</strong> AND pmi.type IN ('user', 'hidden')) AND (pmi.deleted = 0) GROUP BY pmi.thread_id ORDER BY last_updated DESCThis is the exact same query as when user 18 looks at their own messages (uid 23 isn't referenced at all), of which there are none (in this example). In other words, the user admin gets their own message listing when trying to see a member's messages...
Same behaviour observed for user 1 as well.
Comment #7
berdirStrange.
- Are you sure you are using the most recent version of 6.x-2.x?
- Again, do you have changed the privatemsg url prefix in the settings?
- What user is the $account object passed to that function, 18 or 23?
- Can you add a dpm(func_get_args()); debug call to the function privatemsg_list_page(), what are the arguments received by that function?
Comment #8
marktheshark commentedI reverted back to using Base URL path messages, and user-1 and user-18 were able to see user-23's messages, but now all users have lost their 'Messages' tab from their account page.
It seems to me privatemsg should not pass someone's own account as an argument when viewing another user's messages.
Comment #9
berdirThat was the setting I was talking about, it has been renamed in the UI...
Yes, it shouldn't, I'll try again myself with the same configuration.
Comment #10
berdirAre you using i18n.module?
If yes, check if the privatemsg_url_prefix variable has language-specific configuration for the privatemsg_url_prefix setting.
This has caused very weird issues on my test site.
Comment #11
marktheshark commentedYes, I am using i18n. Haven't configured anything locale/language related in the Base URL path though, just user/%user/messages, as mentioned above (if I'm understanding your question correctly).
Comment #12
berdirNeither did I, but somehow, I had a locale specific setting for "privatemsg_url_prefix" in the i18n_variable table. Check that table directly.
Comment #13
marktheshark commentedChecked i18n_variable table.
Only privatemsg variables found:
...for languages installed. No privatemsg_url_prefix found.
Comment #14
berdirI simply have no clue what could causing this..
A few things to try..
- What is the output of this query:
Should be:
And second, implement hook_menu_alter() in a custom module and add (you need devel.module enabled):
Then rebuild the menu.
Third, you can try a different base path, for example 'user/%user/pm'
Comment #15
marktheshark commentedSorry for the delay. Tried the query:
I'll give a try to your other suggestions tomorrow.
Comment #16
berdirOh, I have an idea.
Did you chose list as your default listing?
Try to set it to inbox instead, I'm pretty sure it will work fine then.
Should be rather easy to fix, I'll come up with a patch once you confirmed that this is the issue.
Comment #17
marktheshark commentedI'll try that, though I have no idea where the configuration setting for the listing is...
Comment #18
berdirJust a bit above the base URL path setting in "Configure listings".
Comment #19
marktheshark commentedAttaching screenshot for configure listings section.
I see no default listing setting available... :-( Can't even find the word 'inbox' anywhere in the source...
Comment #20
berdirAh, now I got it.
Sorry for the confusion. The problem is that you don't have privatemsg_filter enabled (which would provide that option). And we don't have any tests for this case.
The fix is trivial, try the attached patch.
Comment #21
marktheshark commentedTried to patch it with patch (for Windows) in the same directory as privatemsg.module:
Should I have tried git?
Anyway, I made the code change manually. No change, user 1 cannot see any private messages...
Comment #22
berdirYou probably either need a new version of patch or git to apply these patches, yes. But it's only a one line change.
Did you rebuild the menu after applying the patch? by re-saving the menu selection, for example.
Comment #23
marktheshark commentedYay, flushed caches and it did the trick. Sorry about that... Will this be ported to the 6.x-2.x-dev branch soon?
Btw, I got patch from http://gnuwin32.sourceforge.net/packages/patch.htm
Not only did it not work, but it crashed as well (on Win 7 x64).
Many thanks for your support, I assume for a total overview of messages exchanged one would need to create a view?
Comment #24
berdirYes, I will commit the patch soon, I'll try to improve the tests before doing that, though.
Yes, you will need views, but you currently can't do that because we don't provide views integration for messages and privatemsg_views doesn't support 6.x-2.x. It is just way to complex right now.
Comment #25
berdirCommited the patch.