If you have multiple pending invitations (when using approval required) displayed at buddylist/[uid]/buddies/requests you always accept/decline the first user in the table regardless of which accept/decline submit button you click. In otherwords, the form always gets submitted with the requester/requestee hidden values of the first form on the page. I tried this in FireFox 1.5 and IE7 with same behavior. I changed the code to give each form a unqiue id thinking that might be the problem and that had no effect. Looking at the forms in the table it appears that they are correct with each having th correct hidden values but the submit is always the first forms values.
Any ideas?
Thx.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | buddylist.patch_2.txt | 10.93 KB | nodestroy |
| #14 | buddylist.patch_1.txt | 17.69 KB | nodestroy |
| #10 | buddylist.patch_0.txt | 12.37 KB | nodestroy |
| #8 | buddylist.patch.txt | 8.19 KB | nodestroy |
| #6 | buddylist.module.txt | 66.39 KB | dldege |
Comments
Comment #1
dldege commentedActually looking at it again I think it has to do with the hidden form token values which are the same for both all the forms. I assume this means on the server side that drupal will get some cached version of this form (the first on on the page) that matches the token and use that which has the wrong hidden values.
I'll test this and see.
Comment #2
dldege commentedCouldn't get it working - but I did mess up the tokens enough to get validation errors.
Comment #3
dldege commentedI'm still stuck with this - can anyone help or shed some insight?
Comment #4
p_palmer commentedI can confirm this...
The error in the buddylist.module code is at these functions....
It seems to be around this repeated snippet of code...
Looking at the above, the drupal_get_form() is called to create a form for each user in the list, but passes EXACTLY the same $form_id for each iteration.
Form.inc expects unique $form_ids per page.
When form.inc handles the submit, as all of the forms are the same name, we always get back the first form, or in other words user on the list.
Therefore, this section of the code is probably invalid and requires rework to stop this 'feature' happening for all the above functions !!!
Can anyone else help further this on?
Comment #5
dldege commentedYou are right with the duplicate forms. I'm running out of time to get a solution so I'm going to do something that is not form based similar to buddy list add and remove. In other words the pending list table will have a link for each user to 'cancel' which will then display a confirm_form() with the correct values. This should be pretty easy and I can reuse the existing form submit handler for cancel operation.
I'll post the code when it works - I won't be able to make it a patch at this time since I have so many other modifications to buddylist but I'll revisit all my changes and submit patches after my project is completed.
Comment #6
dldege commentedGot it all working. The forms are gone and replaced with links for accept/deny/cancel. Those links go to pages with appropriate confirm_form() forms.
Here is my buddylist.module with this change and all of my other modifications - use at your own risk :)
Comment #7
p_palmer commentedi have been using buddylist.module,v 1.48.2.40 2007/01/05 18:49:23 fago Exp $
thanks but your version throws a wobbly under 4.7.5, i can see it is for dru 5.0 only (e.g. drupal_mail calls)
unfortunately, there are too many changes for me to decypher what is what, maybe someone can backport?
anymore for anymore ?
Comment #8
nodestroy commentedthis solution is near to dldege´s but the rest of the module is untouched...
Comment #9
fagothanks for your work.
But could you clean it up a bit more, before it goes in please:
Furthermore I wondered if this issue applies to the cancel buttons to?
Comment #10
nodestroy commentedhere with the favoured changes, also including the cancel buttons ;)
Comment #11
fagothanks, this will fix a lot of bugs. however there are still some invite-phrases in there - buddylist does requests, but no invites.
Comment #12
dldege commentedThe invite/invitation is what I was using in my project so when I made the original change for this bug I just used that language. I think we should introduce a mapping for request, requests, requested, etc. into buddylist_translation() so that this can be a user option.
Then the menu handlers could set their titles, etc. in the buddylist way using t('xxxxx', buddylist_translation()).
Comment #13
fagoyep, I agree, however this is another issue. Feel free to open one.. I'd be happy about a patch.
Comment #14
nodestroy commentedone more, with - i hope so - correct phrases
Comment #15
fagodamn, now it doesn't apply any more!
could you please reroll it against the latest code?
(there was a commit recently: http://drupal.org/cvs?commit=60462)
Comment #16
nodestroy commentednow it should work ;)
Comment #17
fagothanks!!
Committed to 5.x and HEAD.
Comment #18
rbburton commentedHas this been backported to 4.7?
Comment #19
fagono, feel free to provide a patch..
Personally I'm concentrating on 5.x now, as I'd prefer one stable branch to two buggy branches.. However, of course any backports of fixes are welcome!
Comment #20
(not verified) commented