Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
To reproduce this bug goto /messages and use one of the AJAX actions like "Mark as read"/"Mark as unread". Then try to sort the messages.
The soring is broken because the links get rewirtten to point to /system/ajax
Example URL for "Subject" link:
/system/ajax?destination=messages/list&sort=asc&order=Subject
Some users might search for this issue with the generated PHP error:
Notice: Undefined index: form_build_id in ajax_get_form() (line 312 of server/path/to/drupal/includes/ajax.inc).
Comment | File | Size | Author |
---|---|---|---|
#8 | fix_ajax_links.patch | 1.05 KB | Berdir |
Comments
Comment #1
BerdirThis is nasty, nice catch.
This however sounds like a core issue to me and we can probably not solve it in a clean way.
Maybe if sorting could be done through AJAX as well, but I have no clue if that is possible.
Comment #2
derjochenmeyer CreditAttribution: derjochenmeyer commentedHow does the AJAX functionality get added for the actions and the delete button? Is this not something privatemsg is doing?
Comment #3
BerdirThe request is sent with AJAX, the action is done and the whole table is rebuild and then replaced. But the problem is that when the table is rebuilt, the current URL ($_GET['q']) is system/ajax. And all links which point to the current page, especially those created by theme_table(), which does create the sorting links.
So we are really just glueing the different parts together which cause this error.
I need to talk to some of of the AJAX people what to do here.
Comment #4
derjochenmeyer CreditAttribution: derjochenmeyer commentedIts not even limited to the sorting. If you perform an action "Mark as read"/"Mark as unread"/"Delete" and use the "The previous action can be undone." link the "undo" works, but the destination is set to "system/ajax".
For reference the sorting URL is set in the core function tablesort_header (includes/tablesort.inc, line 169) the undo link ist build in function privatemsg_operation_execute (privatemsg.module, line 2118).
Comment #5
BerdirYes, it affects everything that is built durin the AJAX request, although I thought we had a workaround for the undo link.
Comment #6
BerdirLooks like can fix it with a simple hack...
(18:39:31) merlinofchaos: You'll probalby need to set $_GET['q'] to the 'right' path.
Will work on a patch soon.
Comment #7
BerdirPlease try the attached patch.
Comment #8
BerdirWrong status and forgot file.
Comment #9
derjochenmeyer CreditAttribution: derjochenmeyer commentedThanks for the patch. The patch fixes the originally reported bug => fixes sorting.
But it does NOT fix the undo-link-bug reported in #4
Comment #10
BerdirI can not reproduce the undo bug, this has already been fixed a while ago with a very similiar hack. Are you sure that you are using the most recent version of Privatemsg-7.x-1.x (aka, newer than 7.x-1.0) ?
Comment #11
derjochenmeyer CreditAttribution: derjochenmeyer commented/messages
/messages/undo/action?destination=system/ajax
which points (obviously) to a blank page.Comment #12
BenK CreditAttribution: BenK commentedFor me, the patch also fixes the originally reported sorting bug.
As for the undo-link-bug, I don't have that problem at all. Undo links work for me both with and without the patch. The link is being sent to the proper place.
I did notice one other small issue, however: After you use the "Mark as read/unread" action, the "check all" checkbox is missing on the subsequent screen.
--Ben
Comment #13
BerdirSelect all checkbox is a core bug, see #1031148: Select-all checkbox is not added when updating a table with #ajax
Comment #14
BerdirSetting back to needs review since we can't reproduce the undo but and the patch fixes the reported sorting issue.
We can still try to figure out why it doesn't work for @derjochenmeyer after this patch has been commited.
Comment #15
BerdirCommited the patch, thanks for reporting and testing.
Setting this back to postponed ( maintainer needs more info) as neither I nor BenK were able to reproduce your issue.
I'm not sure how reliable the drush --dev switch, can you try to specific explicitly privatemsg-7.x-1.x-dev? Or do a CVS checkout...
Comment #16
BerdirClosing this issue as there has been no response in multiple weeks.
Comment #18
nguyentran CreditAttribution: nguyentran commentedHello,
I have the same problem when I add ajax paging for my inline form edit by ajax, and the patch work for me, Thank you so much. Especial thank to Berdir with your explaination.
Comment #19
geoandri CreditAttribution: geoandri commentedI have the same problem but i am a newbie in drupal.
Can you help me apply the patch?
Where do i have to execute the patch commands?
thank you
Comment #22
Berdir