Activating 'hidden' visibility flag.
[platal.git] / modules / profile / addresses.inc.php
index 62d21ea..fa005fb 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2011 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -27,7 +27,7 @@ class ProfileSettingAddresses implements ProfileSetting
         $addresses = array();
 
         if (is_null($value)) {
-            $it = Address::iterate(array($page->pid()), array(Address::LINK_PROFILE), array(0));
+            $it = Address::iterate(array($page->pid()), array(Address::LINK_PROFILE), array(0), Visibility::get(Visibility::VIEW_ADMIN));
             while ($address = $it->next()) {
                 $addresses[] = $address->toFormArray();
             }
@@ -47,8 +47,8 @@ class ProfileSettingAddresses implements ProfileSetting
 
         Phone::deletePhones($page->pid(), Phone::LINK_ADDRESS, null, $deletePrivate);
         Address::deleteAddresses($page->pid(), Address::LINK_PROFILE, null, null, $deletePrivate);
-        Address::saveFromArray($value, $page->pid(), Address::LINK_PROFILE, null, $deletePrivate);
         AddressReq::purge_requests($page->pid(), 0, 0, Address::LINK_PROFILE);
+        Address::saveFromArray($value, $page->pid(), Address::LINK_PROFILE, null, $deletePrivate);
         if (S::user()->isMe($page->owner) && count($value) > 1) {
             Platal::page()->trigWarning('Attention, tu as plusieurs adresses sur ton profil. Pense à supprimer celles qui sont obsolètes.');
         }