I have set the Administrator permissions to have "Read All Private Messages".

When I go to:
user/[uid]/messages

I can see all the conversations for that user.

When I click a message, I get Page Not Found.

Are there other permissions I need to set to see these messages?

Thanks,
Andy

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

This shouldn't happen. Do you also have read privatemsg permission?

Can you try the 2.x-dev branch and check if you get Page not Found or Access Denied?

Berdir’s picture

Status: Active » Postponed (maintainer needs more info)

Also, some screenshots (privatemsg permission configuration, list of messages, page not found message (with visible URL) and anything you think that could help) would be great.

nagybal’s picture

FileSize
50.16 KB

I have the same issue. An other thing to mention that in my case if I logon to the site first, it works. But if I log of it does not.

The exact EM is the:

Page not found
The requested page could not be found.

http://xxx.xxx/messages/view/686
issue the same if I disable the short links
http://xxx.xxx/?q=messages/view/686

PM config see attachment.

Berdir’s picture

@3 This is another issue, that has already been fixed in the 6.x-2.x-dev branch but will not be backported. 6.x-2.x-dev will display Access denied in that case.

nagybal’s picture

Is there a link to the login page on 6.x-2.x-dev ?

Berdir’s picture

No that is something you can and have to handle yourself, see #644026-10: Access denied instead of Page not found for anonymous.

nagybal’s picture

Thank you! Working great!

Island Dave’s picture

I'm also now getting a Page Not Found error while trying to view any message. Everything else works, including off-site mail notifications. The lists show messages for the correct user, and the list is accurate, including new message flag. The link to view the message is correct (.../message/view/13 or .../message/view/15#new for instance), but upon clicking to view the message at that link, page not found is returned. New vs Read does not matter, neither displays on the view page.

I am admin user, have all perms enabled to be certain, attempting to view a message sent to me. Again, the list of messages, the new message notification, even the deletion of messages is working just fine. Only the view of the message itself is borked.

I checked the menu_router table and there is an entry for messages/view/% .

This worked fine for the first hour or two, and I did make changes on the back end to other code, but nothing which should have had any affect on this module. I've tried flushing all caches, rebuilding menu by going to admin module page, and uninstalling/reinstalling the module. Nothing seems to fix the page not found.

I did disable the module called Messaging as well as the Messaging Privatemsg module (which is a beta integration to this one). It makes sense that this is the culprit, but I can't find anything yet which says disabling those modules caused this issue. I tried reenabling both, but no change to the /message/view/# page not found behavior.

Not expecting anyone to solve it based on this info, just logging it here hoping this helps someone else. I'll keep digging.

Berdir’s picture

Strange. Some things you can check:

- Apply the attached patch and post the printed stuff here...
- What modules do you have enabled? Are there any "unofficial" from the issue queue ( like quota, attachments, forward, realname, ...) ?
- Do you have applied any patches to privatemsg (other than the one above)? If you are unsure, back up your privatemsg folder, re-download the latest stable release and try again
- Which release are you actually using? Try also to reproduce this with 6.x-2.x-dev

The attached patch does nothing more than displaying all kinds of debug stuff during thread loading. There are several access checks based on your permissions and if you are a recipient or not. A correct output should look like this:

Attempting to load thread....
Active account: 1 => Berdir
Loading participants participants....
Found participant: 1 => Berdir
Loading messages....
Found 2 messages.
Calculating which messages to load based on paging...
Loading 50 messages, starting with 0
Found mids: 3266, 3295
Loaded messages: Array ( LOTS OF TEXT)
Thread loaded successfully!

Warning: The patch might also print things like a dump of your user account including the password hash, email address and so o, especially on the second-last line which starts with "Loaded messages..". I replaced that stuff with "LOTS OF TEXT" Make sure you remove anything that could reveal some information about you. I'm not really interested in the content of that, it is enough to know *if* something is printed.

If you are uncertain what to paste, you can also send it to me through the contact form.

Berdir’s picture

FileSize
4.04 KB

Forgot the patch..

Island Dave’s picture

Thanks.

Added the patch and got a lot less output than should be there. As the /message/view/# page returns page not found, here is what the patch supplies:

Attempting to load thread....
Active account: 1 => (my user name)
Loading participants participants....
Found participant: 1 => (my user name)
Loading messages....
Found 1 messages.
Calculating which messages to load based on paging...
Loading 1 messages, starting with 1
Found mids: 
Loaded messages: Array ( )

That 'Found mids' and array() are indeed empty.

So, I added some extra debug and managed to get a message to view by changing the $start value in the chunk below around line 368 (with patch applied):
$conversation = db_query_range($query['query'], $start, $max_amount);

to

$conversation = db_query_range($query['query'], 0, $max_amount);

$start was being sent as 1, which to mysql meant position 2. Since there is only one msg in the thread, position 2 doesn't exist.

EDIT: additional info:

In the message main view, I get the following text: "<< Displaying messages 2 - 1 of 1".

Clicking on the linked <<, (which in this case points to .../messages/view/2?start=0 ) I get the same message with "Displaying messages 1 - 1 of 1" with no double arrow link, but the message still displayed just fine (with the hack of $start hard set to 0 still in place, of course).

Haven't found where the bug is introduced since viewing worked fine initially. Thanks for the help on this.

EDIT: Forgot to mention I have the 6.x-1.1 version rather than the dev version, so I am unsure if this bug is there in the dev at this point.

Berdir’s picture

Ok. I suspect this is a bug that happens with a specific configuration or something similiar

- Can you post a screenshot of your privatemsg settings?
- Can you check what happens when you add a reply?
- Is this a new install with 1.1 or did you do an upgrade from another version?
- If the latter, which version did you use before? Have had had patches applied there?
- Can you add the following above "drupal_set_message(t('Calculating which messages to load based on paging...'));" and post the output?

drupal_set_message(t('Checking some variables: start => %start, use_max => %use_max, default => %default, max => %max', array(
        '%start' => $start,
        '%use_max' => variable_get('privatemsg_view_use_max_as_default', FALSE),
        '%default' => variable_get('privatemsg_view_default_amount', 10),
        '%max' => variable_get('privatemsg_view_max_amount', 20))
      ));

Please try this after the above stuff, so that we can actually track it down in case of an actual error on our side...
- Does re-saving the main privatemsg settings page fix this?

Island Dave’s picture

FileSize
34.35 KB

Sure, here are the results:

- Can you post a screenshot of your privatemsg settings?

attached

- Can you check what happens when you add a reply?

Can't add a reply at all with $start = 0 hack removed since I can't get to view the message. Don't see a way to directly call the reply form without trying to load the thread view
With $start = 0 hack, reply saves fine in the thread, I still get the << Displaying messages notification which shows +1 messages than actually makes sense (as in the earlier post above).

- Is this a new install with 1.1 or did you do an upgrade from another version?
- If the latter, which version did you use before? Have had had patches applied there?

New install of 1.1

- Can you add the following above "drupal_set_message(t('Calculating which messages to load based on paging...'));" and post the output?

The new debug line returns:
Checking some variables: start => 1, use_max => 0, default => 10, max => unlimited

- Does re-saving the main privatemsg settings page fix this?

It does not, unfortunately.

Island Dave’s picture

I did just try adding a reply by first starting with the .../message/view/#?start=0 url (which does bring the thread view up fine). Adding a reply returns:

Checking some variables: start => 0, use_max => 0, default => 10, max => unlimited
Checking some variables: start => 2, use_max => 0, default => 10, max => unlimited

along with the page not found error.

The start=>0 is because I forced it via the original GET.
start=>2 would want the third message in the thread, and there are currenly only 2 (the original + 1 reply)

Berdir’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Needs review
FileSize
2.48 KB

Ok, found it.

This happens when when UNLIMITED is enabled and no different default amount is set (aka, the checkbox is unchecked). The attached patch fixes that issue and I've also added a test to confirm this.

Note that the current fix will still allow to view a thread with ?start=something.

Hint: While it is a valid configuration, I would advice against using it. No matter how big your server resources are, at some point this will lead to out of memory errors, if some users have a very big thread.

Status: Needs review » Needs work

The last submitted patch, privatemsg_paging_fix.patch, failed testing.

Island Dave’s picture

Confirmed that this patch fixes the bug I am experiencing.

I ran through a series of send message/reply/view/delete/etc and was able to view all messages and replies with no problem. All $start values now appear correct in the debug, and the thread message counts are also correct.

Thanks for getting this turned around so quickly, very much appreciated!

Berdir’s picture

Status: Needs work » Needs review

#15: privatemsg_paging_fix.patch queued for re-testing.

Berdir’s picture

Test client #33 diesn't seem to like Privatemsg, I can't reproduce these failures locally. Let's try again..

Status: Needs review » Needs work

The last submitted patch, privatemsg_paging_fix.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review

#15: privatemsg_paging_fix.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, privatemsg_paging_fix.patch, failed testing.

Berdir’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Status: Needs work » Needs review

Oh, got it. The version was set to 1.1, which contains a bug in the tests that has been fixed in 1.x-dev.

Berdir’s picture

#15: privatemsg_paging_fix.patch queued for re-testing.

Berdir’s picture

Status: Needs review » Fixed

Thanks for reporting, reviewing, and testing! Committed to all branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

This message is automatically generated. If you feel it could be improved, feel free to comment on http://drupal.org/node/467548

Status: Fixed » Closed (fixed)

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