return ($biolimit > 0 && !empty($bio) && (mb_strlen($bio) > $biolimit));
}
- public function update($orig)
+ function update($dataObject=false)
{
- if ($this->nickname != $orig->nickname) {
- $local = User::getKV('id', $this->id);
- if ($local instanceof User) {
- common_debug("Updating User ({$this->id}) nickname from {$orig->nickname} to {$this->nickname}");
+ if (is_object($dataObject) && $this->nickname != $dataObject->nickname) {
+ try {
+ $local = $this->getUser();
+ common_debug("Updating User ({$this->id}) nickname from {$dataObject->nickname} to {$this->nickname}");
$origuser = clone($local);
$local->nickname = $this->nickname;
$result = $local->updateKeys($origuser);
if ($local->hasRole(Profile_role::OWNER)) {
User::blow('user:site_owner');
}
+ } catch (NoSuchUserException $e) {
+ // Nevermind...
}
}
- return parent::update($orig);
+ return parent::update($dataObject);
}
function delete()
return $uri;
}
+ /**
+ * Returns an assumed acct: URI for a profile. Plugins are required.
+ *
+ * @return string $uri
+ */
+ public function getAcctUri()
+ {
+ $acct = null;
+
+ if (Event::handle('StartGetProfileAcctUri', array($this, &$acct))) {
+ Event::handle('EndGetProfileAcctUri', array($this, &$acct));
+ }
+
+ if ($acct === null) {
+ throw new ProfileNoAcctUriException($this);
+ }
+
+ return $acct;
+ }
+
function hasBlocked($other)
{
$block = Profile_block::exists($this, $other);
$profile = null;
if (Event::handle('StartGetProfileFromURI', array($uri, &$profile))) {
- // Get a local user or remote (OMB 0.1) profile
+ // Get a local user
$user = User::getKV('uri', $uri);
if (!empty($user)) {
$profile = $user->getProfile();