I've seen this bug reported all over the place on Drupal, and mostly it seems to be connected to the use of the $language variable. Not sure if that is the problem here (the code clearly uses this variable), but I get this error only when viewing a user profile, and it goes when switching the module off, so it must be the cause.
Comments
Comment #1
danielb commentedYou have not sufficiently identified a bug, or given me information to reproduce the error. If you are convinced this module is doing something wrong, please describe the problem in the code, or supply a patch.
Comment #2
jpcwebb commentedI'm not a developer, so I'm not producing patches - have changed the component item accordingly. I'm not sure how else to explain this. I also noticed that the button on the profile page where the error occurs shows 'Send on time login link to Object', whereas I presume Object should actually be the username, so I am assuming the part of code that is referencing the username is conflicting with something in common.inc
Comment #3
jpcwebb commentedComment #4
jpcwebb commentedThink I've found the problem, and I suspect (though can't be certain) that it is a conflict with the Realname module. On line 168, the function login_one_time_button is passed a refernce to $account rather than the username, so changing this from
to
seems to fix the problem.
Comment #5
jpcwebb commentedAh no, that didn't work - although it got rid of the error and allowed the button to render the username correctly, the button itself doesn't work (500 error - seems to be unable to find the email address to send to) :(
So I guess login_one_time_button needs an actual reference to the user account, not just the name - but then it causes the original problem which seems to be centred around the use of $username on line 215 in function login_one_time_button_form. So I think somewhere in the logic for login_one_time_button the test for the $username as an object is failing and being passed onto the form instead of the name value, maybe because it has been affected by Realname (at a guess - from what I understand it dynamically replaces references to the name property of $user and $account objects). More thought needed...
Comment #6
danielb commentedThank you, I now see the problem is in the function login_one_time_button()
This code:
if (is_object($username) && isset($account->name)) {should be this
if (is_object($username) && isset($username->name)) {Comment #7
danielb commentedI have committed the fix to CVS and created a new release (RC2) for this module.
Comment #8
danielb commentedBy the way the fix you tried should have worked, and I have also made that change in the new version in addition to fixing the bug, so you may be experiencing a second problem. If it continues to be unable to find the email address you might need to start a 2nd issue for that (that way i can track changes properly in the CVS log). PS now you are a developer.
Comment #9
jpcwebb commentedHi again,
Yes, I spotted that line of code too and changed it, also fixing the button display, but not the actual functioning of it. For the time being I have disabled the button on the profile page and just relying on the bulk action use instead, but I will start a new issue.