Posted by catorghans on June 22, 2009 at 3:05pm
| Project: | Ubercart Addresses |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
In the readme file the next text is displayed:
"To be complete, I should add 'view own default address', 'view own
addresses', and 'add/edit own addresses', but I can't see that any of
these make sense."
I now have a use case for the "Add/edit own addresses". A customer of me wants exactly that. Because he wants control over the addresses used by his customers. He creates the drupal users, adds the addresses and gives them access to the ubercart shop (only visible for users with a certain role). He does not want his customers to be able to change the address.
I can help create a patch for this, but a little advise from someone who is familiar with coding this module will help me a lot.
Comments
#1
If you haven't looked at the code, start looking at uc_addresses.module. I believe the permission codes are defined near the top and then you can search for references to these. This should give you an idea of how they work.
Then you have to find all the places where a person can add/edit his own address. The good news is that this is the same set of areas where someone else can edit an address, so you'll find that there is an exception that checks that the current user's ID matches the ID of the user who owns the address. So it would seem that you just need to change all these from user ID == address user ID to user ID == address user ID && can add/edit own addresses.
One special thing to watch: when the customer places an order, the address will be automatically saved if the option is set for the store. Obviously, you need to add a check for the permission here as well. A user who can't save addresses can't have them automatically saved.
The same reasoning would seem to apply to registration. If you can't save your addresses, then you shouldn't be required to enter an address during registration. The only problem there is that you don't have a role for the user until after they are registered. My inclination would be to allow adding an address during registration if the option is set.
#2
Thanks!
I did look at the code, but this really helps.
It does seem logical that if you allow adding address during registration that you also allow "edit own address", so I'll stick with your suggestion.
#3
This version already seems to work.
I want to add another feature, related to this.
An option to not edit the checkout billing and delivery panes. You can still choose the addresses already available from the "My Account" pages, but not change them.
#4
This feature request is related to get more control over the addresses used by store customers.
http://drupal.org/node/500614
#5
This feature request has been marked postponed, which is my way of saying that it probably won't get included in the foreseeable future, but that it has some merit and shouldn't be discarded.
#6
Hi,
How to modify fields position in uc_address,I want the fields to be placed side by side of the form.Instead the fields are placed one by one.
Need help.
Jhansi.
#7
@jhansi: Create a new issue. Your request is not relevant to this issue.
#8
The patch attached above appears to no longer provide proper permissions. Can someone confirm?
#9
Ignore the comment, my issue is caused by #1252424: Incompatible with 'me' aliases
#10
Permissions for add/edit own addresses are implemented in 6.x-2.x-dev.
#11
Automatically closed -- issue fixed for 2 weeks with no activity.