Re: Re: Current rollup patch
Storing Address information in User Profile (84 replies) Thu, 10/25/2007 - 18:04
- Profile Module integration (10/08/2009 - 09:17)
- CCK approach? (09/16/2009 - 00:23)
- Re: CCK approach? (10/28/2009 - 17:12)
- hook form alter solution (07/29/2009 - 07:59)
- majnoona@drupal.org (10/28/2009 - 16:12)
- The other way round! (08/23/2009 - 08:44)
- Re: The other way round! (09/07/2009 - 16:29)
- Last message (05/29/2008 - 11:35)
- Re: Last message (07/08/2008 - 09:04)
- Re: Re: Last message (04/11/2009 - 02:53)
- Where did this end up? (06/19/2009 - 07:57)
- Agree (07/26/2009 - 08:58)
- Where did this end up? (06/19/2009 - 07:57)
- Re: Re: Last message (04/11/2009 - 02:53)
- Re: Last message (07/08/2008 - 09:04)
- Re: Storing Address information in User Profile (05/21/2008 - 12:29)
- Using PostGRE? (05/22/2008 - 09:40)
- Re: Using PostGRE? (05/23/2008 - 13:15)
- Re: Re: Using PostGRE? (05/24/2008 - 16:18)
- Discovered a small bug.
I (05/24/2008 - 17:03)
- Duplicated bug report (05/26/2008 - 09:56)
- Module now on drupal.org (05/26/2008 - 16:44)
- Duplicated bug report (05/26/2008 - 09:56)
- Discovered a small bug.
I (05/24/2008 - 17:03)
- Re: Re: Using PostGRE? (05/24/2008 - 16:18)
- Re: Using PostGRE? (05/23/2008 - 13:15)
- Using PostGRE? (05/22/2008 - 09:40)
- A new version of uc_addresses (05/16/2008 - 22:21)
- Thanks for the support, everyone! (05/19/2008 - 08:39)
- Re: Thanks for the support, everyone! (05/19/2008 - 09:34)
- Thanks, Ryan (05/19/2008 - 10:25)
- Re: Thanks, Ryan (05/19/2008 - 20:33)
- bug? (05/21/2008 - 01:16)
- Re: Problems with new uc_addresses (05/21/2008 - 10:02)
- bug? (05/21/2008 - 01:16)
- Re: Thanks, Ryan (05/19/2008 - 20:33)
- Thanks, Ryan (05/19/2008 - 10:25)
- Re: Thanks for the support, everyone! (05/19/2008 - 09:34)
- Re: A new version of uc_addresses (05/19/2008 - 06:59)
- Well done Tony,I don't (05/17/2008 - 21:11)
- Re: A new version of uc_addresses (05/18/2008 - 02:22)
- Re: Re: A new version of uc_addresses (05/18/2008 - 12:37)
- Thanks for the support, everyone! (05/19/2008 - 08:39)
- Module (05/01/2008 - 09:57)
- Re: Module (05/03/2008 - 19:24)
- Re: Storing Address information in User Profile (03/21/2008 - 15:03)
- Re: Re: Storing Address information in User Profile (03/24/2008 - 09:46)
- Re: Re: Re: Storing Address information in User Profile (03/24/2008 - 15:36)
- rich wrote:Here's another (03/25/2008 - 20:07)
- Re: rich wrote:Here's another (03/30/2008 - 18:35)
- Re: Re: rich wrote:Here's another (04/10/2008 - 04:19)
- Re: rich wrote:Here's another (03/30/2008 - 18:35)
- rich wrote:Here's another (03/25/2008 - 20:07)
- Re: Re: Re: Storing Address information in User Profile (03/24/2008 - 15:36)
- Re: Re: Storing Address information in User Profile (03/24/2008 - 09:46)
- Current rollup patch (03/08/2008 - 01:58)
- Re: Current rollup patch (03/08/2008 - 05:00)
- Re: Re: Current rollup patch (03/08/2008 - 10:45)
- Re: Re: Re: Current rollup patch (03/08/2008 - 13:22)
- Re: Re: Re: Re: Current rollup patch (03/08/2008 - 15:01)
- Re: Re: Re: Current rollup patch (03/08/2008 - 13:22)
- Re: Re: Current rollup patch (03/08/2008 - 10:45)
- Re: Current rollup patch (03/08/2008 - 05:00)
- Re: Storing Address information in User Profile (10/26/2007 - 08:13)
- Re: Re: Storing Address information in User Profile (10/26/2007 - 16:53)
- Re: Re: Re: Storing Address information in User Profile (10/26/2007 - 22:36)
- Re: Re: Re: Re: Storing Address information in User Profile (10/30/2007 - 15:34)
- Re: Re: Re: Re: Re: Storing Address information in User Profile (10/31/2007 - 08:54)
- Re: Re: Re: Re: Re: Re: Storing Address information in User Prof (10/31/2007 - 09:25)
- Re: Re: Re: Re: Re: Re: Re: Storing Address information in User (11/08/2007 - 13:20)
- Re: Re: Re: Re: Re: Re: Re: Re: Storing Address information in U (12/08/2007 - 18:57)
- HOWTO: Make uc_store load profile addresses if they exist (02/23/2008 - 11:43)
- Thanks!
I hope you can get (02/23/2008 - 16:04)
- Re: Thanks!
I hope you can get (02/24/2008 - 12:51)
- Re: Re: Thanks!
I hope you can get (02/24/2008 - 15:26)
- Re: Re: Re: Thanks!
I hope you can get (02/28/2008 - 05:31)
- Re: Re: Re: Re: Thanks!
I hope you can get (02/28/2008 - 10:21)
- Re: Re: Re: Re: Re: Thanks!
I hope you can get (03/05/2008 - 12:08)
- Re: Re: Re: Re: Re: Re: Thanks!
I hope you can get (03/05/2008 - 12:24)
- Re: Re: Re: Re: Re: Re: Re: Thanks!
I hope you can get (03/05/2008 - 14:07)
- Re: Re: Re: Re: Re: Re: Re: Re: Thanks!
I hope you can get (03/05/2008 - 14:57)
- Thanks for that, bendiy. (03/05/2008 - 19:30)
- Re: Thanks for that, bendiy. (03/06/2008 - 07:42)
- Re: Re: Thanks for that, bendiy. (03/06/2008 - 08:03)
- Re: Re: Re: Thanks for that, bendiy. (03/06/2008 - 08:34)
- Re: Re: Re: Re: Thanks for that, bendiy. (03/06/2008 - 08:52)
- Re: Re: Re: Re: Re: Thanks for that, bendiy. (03/06/2008 - 11:07)
- Quote:My only critique is (03/06/2008 - 16:02)
- Re: Quote:My only critique is (03/06/2008 - 18:46)
- Re: Re: Quote:My only critique is (03/06/2008 - 19:53)
- Re: Re: Re: Quote:My only critique is (03/07/2008 - 03:43)
- Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 10:39)
- Re: Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 14:57)
- Re: Re: Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 19:55)
- Re: Re: Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 16:46)
- Re: Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 14:57)
- Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 10:15)
- Re: Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 19:22)
- Re: Re: Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 19:46)
- Thanks for the example. I (03/08/2008 - 04:59)
- Re: Re: Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 19:46)
- Re: Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 14:54)
- Re: Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 19:22)
- Re: Re: Re: Re: Quote:My only critique is (03/07/2008 - 10:39)
- Re: Re: Re: Quote:My only critique is (03/07/2008 - 03:43)
- Re: Re: Quote:My only critique is (03/06/2008 - 19:34)
- Re: Re: Quote:My only critique is (03/06/2008 - 19:53)
- Re: Quote:My only critique is (03/06/2008 - 18:46)
- Quote:My only critique is (03/06/2008 - 16:02)
- Re: Re: Re: Re: Re: Thanks for that, bendiy. (03/06/2008 - 11:07)
- Re: Re: Re: Re: Thanks for that, bendiy. (03/06/2008 - 08:52)
- Re: Re: Re: Thanks for that, bendiy. (03/06/2008 - 08:34)
- Re: Re: Thanks for that, bendiy. (03/06/2008 - 08:03)
- Re: Thanks for that, bendiy. (03/06/2008 - 07:42)
- Thanks for that, bendiy. (03/05/2008 - 19:30)
- Re: Re: Re: Re: Re: Re: Re: Re: Thanks!
I hope you can get (03/05/2008 - 14:57)
- Re: Re: Re: Re: Re: Re: Re: Thanks!
I hope you can get (03/05/2008 - 14:07)
- Re: Re: Re: Re: Re: Re: Thanks!
I hope you can get (03/05/2008 - 12:24)
- Re: Re: Re: Re: Re: Thanks!
I hope you can get (03/05/2008 - 12:08)
- Re: Re: Re: Re: Thanks!
I hope you can get (02/28/2008 - 10:21)
- Re: Re: Re: Thanks!
I hope you can get (02/28/2008 - 05:31)
- Re: Re: Thanks!
I hope you can get (02/24/2008 - 15:26)
- Re: Thanks!
I hope you can get (02/24/2008 - 12:51)
- Thanks!
I hope you can get (02/23/2008 - 16:04)
- Re: Re: Re: Re: Re: Re: Re: Re: Re: Storing Address information (12/10/2007 - 13:50)
- Hi
There's a typo in the (12/18/2007 - 07:48)
- Re: Hi There's a typo in the (01/26/2008 - 11:07)
- Hi
There's a typo in the (12/18/2007 - 07:48)
- HOWTO: Make uc_store load profile addresses if they exist (02/23/2008 - 11:43)
- Re: Re: Re: Re: Re: Re: Re: Re: Storing Address information in U (12/08/2007 - 18:57)
- Re: Re: Re: Re: Re: Re: Re: Storing Address information in User (11/08/2007 - 13:20)
- Re: Re: Re: Re: Re: Re: Storing Address information in User Prof (10/31/2007 - 09:25)
- Re: Re: Re: Re: Re: Storing Address information in User Profile (10/31/2007 - 08:54)
- Re: Re: Re: Re: Storing Address information in User Profile (10/30/2007 - 15:34)
- Re: Re: Re: Storing Address information in User Profile (10/26/2007 - 22:36)
- Re: Re: Storing Address information in User Profile (10/26/2007 - 16:53)

Okay, I've managed to finish it. Good timing because my girl wants me to help in the garden. This is basically what I changed:
<?php/**
* Implementation of hook_user().
*/
function uc_addresses_user($op, &$edit, &$account, $category = null){
global $user;
switch ($op){
case 'view':
if (user_access('edit and view addresses') || $user->uid == $account->uid) {
$link = l('here', 'user/'. $account->uid .'/addresses');
$items = array();
$items['addresses'] = array('title' => t('Manage Addresses'),
'value' => 'Click ' . $link . ' to manage your addresses.',
'class' => 'member',
);
return array(t('Addresses') => $items);
}
else {
return NULL;
}
case 'register':
// get the address form
$form = uc_addresses_pane_address('new', $arg1, $arg2);
$form = array($form['contents']); // modify to what we need
$form[0]['#title'] = 'Address'; // rename the fieldset
return $form;
case 'insert':
$address = (object)$edit;
uc_addresses_add_address($address);
return;
case 'delete':
db_query("DELETE FROM {uc_addresses} WHERE uid = %d", $account->uid);
return;
}
} /**
* Implementation of hook_form_alter().
*
* Here we're going to override the saved address options on the checkout form
*/
function uc_addresses_form_alter($form_id, &$form) {
global $user;
if ($form_id == 'uc_cart_checkout_form') {
$options = array('0' => t('Select one...'));
// grab the addresses saved from previous checkouts
if ($addresses = uc_get_addresses($user->uid, $type)) {
foreach ($addresses as $address) {
$options[drupal_to_js($address)] = $address['street1'];
}
}
// grab the addresses saved at registration or added in the user profile
if ($addresses = uc_addresses_get_address($user->uid, NULL, 0)) {
foreach ($addresses as $address) {
$address = (array)$address;
$options[drupal_to_js($address)] = $address['street1'];
}
}
// inject into form
$form['panes']['delivery']['delivery_address_select']['#options'] = $options;
$form['panes']['billing']['billing_address_select']['#options'] = $options;
}
}
?>
I've uploaded the files so you guys can test/improve this. Look forward to seeing what you come up with.
Drupal Contrib API
Freestyle Systems