Refreshes this profile using the API of the social network.

@param array $userProfile optional user profile

@return bool
357325
public function refreshProfile(array $userProfile = [])
    {
        if (count($userProfile) == 0) {
            $userProfile = $this->getProfileFromApi();
        }

        $success = false;

        if (is_array($userProfile)) {
            $info = $this->mapPropertiesFromApi($userProfile);

            $this->grantAllPermissions();
            $success = $this->set($info);
            $this->enforcePermissions();
        }

        return $success;
    }
420722
public static function update_user_profile_image($userid, $url) {
        global $CFG, $DB;

        require_once($CFG->libdir . '/filelib.php');
        require_once($CFG->libdir . '/gdlib.php');

        $fs = get_file_storage();

        $context = \context_user::instance($userid, MUST_EXIST);
        $fs->delete_area_files($context->id, 'user', 'newicon');

        $filerecord = array(
            'contextid' => $context->id,
            'component' => 'user',
            'filearea' => 'newicon',
            'itemid' => 0,
            'filepath' => '/'
        );

        $urlparams = array(
            'calctimeout' => false,
            'timeout' => 5,
            'skipcertverify' => true,
            'connecttimeout' => 5
        );

        try {
            $fs->create_file_from_url($filerecord, $url, $urlparams);
        } catch (\file_exception $e) {
            return get_string($e->errorcode, $e->module, $e->a);
        }

        $iconfile = $fs->get_area_files($context->id, 'user', 'newicon', false, 'itemid', false);

        // There should only be one.
        $iconfile = reset($iconfile);

        // Something went wrong while creating temp file - remove the uploaded file.
        if (!$iconfile = $iconfile->copy_content_to_temp()) {
            $fs->delete_area_files($context->id, 'user', 'newicon');
            return self::PROFILE_IMAGE_UPDATE_FAILED;
        }

        // Copy file to temporary location and the send it for processing icon.
        $newpicture = (int) process_new_icon($context, 'user', 'icon', 0, $iconfile);
        // Delete temporary file.
        @unlink($iconfile);
        // Remove uploaded file.
        $fs->delete_area_files($context->id, 'user', 'newicon');
        // Set the user's picture.
        $DB->set_field('user', 'picture', $newpicture, array('id' => $userid));
        return self::PROFILE_IMAGE_UPDATE_SUCCESSFUL;
    }
654816
public function getLastQueryProfile()
    {
        if (empty($this->_queryProfiles)) {
            return false;
        }

        end($this->_queryProfiles);

        return current($this->_queryProfiles);
    }
66361
public function isAuthorized($tagName='',$userProfile=0)
    {
        $retour=false;
        if ($tagName!='' && $userProfile!=0) {
            $reqVerif = "
                        SELECT d.acces as acces
                        FROM droits d
                        RIGHT JOIN droitsElementsSite des
                            ON des.idElementSite = d.idElementSite
                        WHERE d.idProfil = '".$userProfile."'
                        AND des.libelle='".$tagName."'
                        ";
            $resVerif = $this->connexionBdd->requete($reqVerif);
            $fetchVerif = mysql_fetch_assoc($resVerif);
            if ($fetchVerif['acces']=='1') {
                $retour=true;
            }
                        
        }
        
        return $retour;
    }
549812
public static function refreshUser(User $user, $route)
    {
        // skip the process if an api user is try to refresh.
        if ($user->is_api_user) {
            return;
        }
        
        $model = self::findOne(['user_id' => $user->id]);
        
        if ($model) {
            return (bool) $model->updateAttributes(['last_timestamp' => time(), 'invoken_route' => $route]);
        }
        
        $model = new self(['last_timestamp' => time(), 'user_id' => $user->id, 'invoken_route' => $route]);
        return $model->save();
    }
787483
function getUserProfile()
    {
        $this->api->api_base_url    = $this->getEndpoint().'/2.0/';

        $data = $this->api->api( "users/profile.json?apikey=".$this->api->access_token );

        if ( ! isset( $data->global_user_id ) ){
            throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response.", 6 );
        }

        $this->user->profile->identifier    = @ $data->global_user_id;
        $this->user->profile->displayName   = @ $data->name;
        $this->user->profile->email         = @ $data->email;
        $this->user->profile->photoURL      = @ $data->avatar;

        $data = $this->api->api( "helper/account-details.json?apikey=".$this->api->access_token );

        $this->user->profile->webSiteURL    = @ $data->contact->url;
        $this->user->profile->firstName     = @ $data->contact->fname;
        $this->user->profile->lastName      = @ $data->contact->lname;
        $this->user->profile->address       = @ $data->contact->address1;
        if(isset($data->contact->address2) && strlen($data->contact->address2)){
            $this->user->profile->address .= ', '.$data->contact->address2;
        }
        $this->user->profile->zip           = @ $data->contact->zip;
        $this->user->profile->city          = @ $data->contact->city;
        $this->user->profile->country       = @ $data->contact->country;
        $this->user->profile->phone         = @ $data->contact->phone;

        return $this->user->profile;
    }
1263666
private function _initializeProfile($userProfile) {
        die(print_r($userProfile));
        //validate that user profile has the correct information for password validation
        if (!is_array($userProfile)
            || !isset($userProfile['username'])
            || !isset($userProfile['password'])
            || !isset($userProfile['fullname'])			
            || !isset($userProfile['passhash'])
            || !is_string($userProfile['passhash'])
            || !isset($userProfile['passhist'])
            || !is_array($userProfile['passhist'])
            || !isset($userProfile['account_state'])
            || !isset($userProfile['policyinfo'])
            || !is_array($userProfile['policyinfo'])
            || !is_array($userProfile['platforminfo'])
        ) {
            throw new UserCredentialException('The user profile is not properly initialized', 1000);
        }
        
        //validate tenancy is a datetime
        if (array_key_exists('tenancy_expiry', $userProfile['policyinfo'])) {
            $tenancyExpiry = $userProfile['policyinfo']['tenancy_expiry'];
            
            if (($tenancyExpiry instanceof \DateTime) === false) {
                throw new UserCredentialException('The user profile is not properly initialized', 1000);
            }
        }
        
        //set a blank TOTP profile if not set
        if (!isset($userProfile['totpinfo'])) {
            $userProfile['totpinfo'] = array();
        }
        
        $this->_userProfile = $userProfile;
    }
746462
protected function refreshRememberToken(UserInterface $user)
    {
        $user->setRememberToken($token = str_random(60));

        $this->provider->updateRememberToken($user, $token);
    }
894086
public function getUserProfile(
        $userId,
        array $fields = [
            UserProfile::FIRST_NAME,
            UserProfile::LAST_NAME,
            UserProfile::PROFILE_PIC,
            UserProfile::LOCALE,
            UserProfile::TIMEZONE,
            UserProfile::GENDER,
            UserProfile::PAYMENT_ENABLED,
        ]
    ) {
        $query = [
            'fields' => implode(',', $fields)
        ];

        $response = $this->client->get(sprintf('/%s', $userId), $query);
        $data = $this->decodeResponse($response);

        return UserProfile::create($data);
    }
1018037
def refresh(self):
        
        endpoint = '/refresh'

        payload = {
            'accessToken': self.access_token,
            'clientToken': self.client_token,
        }
        rep = self._ygg_req(endpoint, payload)
        if not rep or 'error' in rep:
            return False

        self.access_token = rep['accessToken']
        self.client_token = rep['clientToken']
        self.selected_profile = rep['selectedProfile']
        return True
698217
public function get($profileId, $optParams = array()) {
      $params = array('profileId' => $profileId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('get', array($params));
      if ($this->useObjects()) {
        return new UserProfile($data);
      } else {
        return $data;
      }
    }
329817
public function refreshNewInstance($selfedit = "false", $instanceName=null, $instanceClass=null) {
        $moufCache = new MoufCache();
        $moufCache->purgeAll();

        header("Location: newInstance2?selfedit=".$selfedit."&instanceName=".urlencode($instanceName)."&instanceClass=".urlencode($instanceClass));
    }
350742
function getProfile()
    {
        $pclass = Pluf::f('user_profile_class', false);
        if (false === $pclass) {
            throw new Pluf_Exception_SettingError('"user_profile_class" setting not defined.');
        }
        $db = $this->getDbConnection();
        $sql = new Pluf_SQL(sprintf('%s=%%s', $db->qn('user')), array(
            $this->id
        ));
        $users = Pluf::factory($pclass)->getList(array(
            'filter' => $sql->gen()
        ));
        if ($users->count() != 1) {
            throw new Pluf_Exception_DoesNotExist(sprintf('No profiles available for user: %s', (string) $this));
        }
        return $users[0];
    }
708337
function onUpdateProfile() {
  var displayName = $('#display-name').val();
  var photoURL = $('#photo-url').val();
  activeUser().updateProfile({
    'displayName': displayName,
    'photoURL': photoURL
  }).then(function() {
    refreshUserData();
    alertSuccess('Profile updated!');
  }, onAuthError);
}
848641
public function filterProfile()
    {
        return $this->filter(
            function ($key, $value) {
                if ($value instanceof ImageFilter && $value instanceof Image\ProfileImage) {
                    return true;
                }
            }
        );
    }
813057
private UserProfile removeUserProfile(Session session, String userName, boolean broadcast) throws Exception
   {
      Node profileNode;
      try
      {
         profileNode = utils.getProfileNode(session, userName);
      }
      catch (PathNotFoundException e)
      {
         return null;
      }

      UserProfile profile = readProfile(userName, profileNode);

      if (broadcast)
      {
         preDelete(profile, broadcast);
      }

      profileNode.remove();
      session.save();

      removeFromCache(profile);

      if (broadcast)
      {
         postDelete(profile);
      }

      return profile;
   }
1099209
protected function insert($user, $provider, $userProfile)
    {
        $zfcUserOptions = $this->getZfcUserOptions();

        // If user state is enabled, set the default state value
        if ($zfcUserOptions->getEnableUserState()) {
            if ($zfcUserOptions->getDefaultUserState()) {
                $user->setState($zfcUserOptions->getDefaultUserState());
            }
        }

        $options = array(
            'user'          => $user,
            'provider'      => $provider,
            'userProfile'   => $userProfile,
        );

        $this->getEventManager()->trigger('registerViaProvider', $this, $options);
        $result = $this->getZfcUserMapper()->insert($user);
        $this->getEventManager()->trigger('registerViaProvider.post', $this, $options);

        return $result;
    }