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.
This issue can be fixed by adding a block in to the content area on user/*/addressbook with context, but if nothing is currently being rendered in the content region then the region will not appear at all.
Comment | File | Size | Author |
---|---|---|---|
#12 | improved_ux_for_no_addresses-2024847-12.patch | 1.65 KB | roderik |
#11 | improved_ux_for_no_addresses-2024847-11.patch | 1.69 KB | guy_schneerson |
Comments
Comment #1
rei CreditAttribution: rei commentedsame issue here
Comment #2
meeli CreditAttribution: meeli commentedComment #3
roderikStatus 'needs review' is for issues which actually have a patch.
I tried to reproduce this, but can't - and don't see a possible cause in the code either (note I didn't write this module, I just randomly wander through issue queues). Depending on permissions I either see an empty page with the expected tabs... or I see an "access denied" message for the page.
Comment #4
madhavaji CreditAttribution: madhavaji commentedHi, I'm getting the same error. I'll give the fix by @meeli a go in the short term.. just thought I'd +1 the issue.
Comment #5
guy_schneerson CreditAttribution: guy_schneerson commentedSame issue on 7.x-2.0-rc7, @meeli tip fixed the issue (added an empty block to content region).
@roderik are you on the latest dev version that may explain it if you are (didn't get a chance to test it on dev).
Comment #6
roderik@guy_schneerson: I tested 7.x-2.0-rc7. Couldn't reproduce.
...but while I confirmed the version number, I spotted something I didn't see before. user/*/addressbook returns a bogus value if $account->uid is not set, which leads to... probably the behavior you are encountering.
In includes/commerce_addressbook.user.inc:
First of all, the comment is wrong: this is a page callback, not an access callback.
And page callbacks may not return FALSE. The last line should read:
return MENU_ACCESS_DENIED;
Can you try that?
I think that will probably solve the "content region does not appear at all" issue, but it may give an 'access denied' message instead, and I don't know why it does that, in your case (instead of giving a page with an 'add address' link). But maybe that brings you one step closer to the solution.
Comment #7
guy_schneerson CreditAttribution: guy_schneerson commentedHi roderik Yes the comment is wrong but I dont think the code ever gets to return FALSE as both the user should be set and commerce_addressbook_page_access() returns a value.
Looks like the function changes the path and as a result the menu_execute_active_handler calls commerce_addressbook_profile_page() that returns an Empty string.
and its the issue of having no content on the page that's an issue.
If I replace the "return $output;" in commerce_addressbook_page_access() with:
the issue is fixed as we now have an empty div.
Comment #8
roderikOK.
1)
I guess what you get, depends on the theme. For me (i.e. in the theme I tested), returning empty output would be fine. That is, I would get a normal 'empty' page with all the tabs rendered normally plus an "add new" link as a local action.
So I assumed that returning an empty string was 'legal' behavior. I can't find any documentation on that. But looking at it,
drupal_set_page_content('')
returns NULL, which I guess implies "we didn't account for this situation", i.e. setting an empty string as main page content is illegal.Meaning, you're right.
2)
I actually did get a weird mangled page when I triggered the 'return FALSE'. Which I simply tested by visiting user/0/addressbook :)
(And I wrongly guessed that your problem with a mangled page came from your $account->uid being empty for some weird reason.)
Comment #9
roderikMmmmyeah. So the status I changed, is not valid anymore. If someone wants to roll a patch and get their name in the commit log, feel free, otherwise I guess I'll feel obliged to at some point, since I fiddled with someone's status :)
(Oh, and, also spotted yesterday: the access callback returns a string instead of just TRUE... which is also strange even though it doesn't matter in practice.)
Comment #10
guy_schneerson CreditAttribution: guy_schneerson commentedYes also got the weird mangled page when forcing a FALSE to return.
Will be happy to put in a patch and will replace the return FALSE.
Will also change the empty div with a bit of helpful text "Your address book is currently empty."
Comment #11
guy_schneerson CreditAttribution: guy_schneerson commentedAttached patch adds an empty address book message, it also cleans up the comments and replaces the return FALSE.
Comment #12
roderikNice.
Changes:
* retutn -> return in comment
* My IDE reminded me that in the first message, $profile_type does not exist. (And $type is empty too.)
* I don't see the reason for doing 'addressbook-noddata', can we name it 'addressbook-nodata'?
Comment #13
guy_schneerson CreditAttribution: guy_schneerson commentedHi @roderik
ow yes just copied the line from commerce_addressbook_profile_page() and missed out that we don't have the $profile_type in commerce_addressbook_page() - thank your IDE from me.
and "noddata" is a typo should be 'nodata' or probably 'addressbook-no-data' best.
Can update the patch tomorrow
Comment #14
roderikI have, please review patch #12
Comment #15
guy_schneerson CreditAttribution: guy_schneerson commentedow yes sorry roderik yes looks perfect.
Can't see anything wrong with the patch, great work, will try and test it later, but I am sure it will work.
Comment #16
guy_schneerson CreditAttribution: guy_schneerson commentedjust tested and works perfectly also looked at the interdiff and all the changes are as you described and make perfect sense.
Comment #17
ath.galanis CreditAttribution: ath.galanis commentedPatch in #12 works perfect fo me too.
Thanks.
Comment #18
Sophie.SKPatch in #12 worked perfectly here too :)
Comment #19
jsacksick CreditAttribution: jsacksick commented