* Remove evil transaction
* Fix text value retrieval method
This commit is contained in:
parent
3d61d003bc
commit
adcda00e76
@ -26,6 +26,8 @@ if (!defined('STATUSNET')) {
|
|||||||
*/
|
*/
|
||||||
class ExtendedProfile
|
class ExtendedProfile
|
||||||
{
|
{
|
||||||
|
protected $fields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -82,12 +84,13 @@ class ExtendedProfile
|
|||||||
*/
|
*/
|
||||||
function getTextValue($name)
|
function getTextValue($name)
|
||||||
{
|
{
|
||||||
|
$key = strtolower($name);
|
||||||
$profileFields = array('fullname', 'location', 'bio');
|
$profileFields = array('fullname', 'location', 'bio');
|
||||||
|
|
||||||
if (in_array(strtolower($name), $profileFields)) {
|
if (in_array($key, $profileFields)) {
|
||||||
return $this->profile->$name;
|
return $this->profile->$name;
|
||||||
} else if (in_array($name, $this->fields)) {
|
} else if (array_key_exists($key, $this->fields)) {
|
||||||
return $this->fields[$name]->field_value;
|
return $this->fields[$key][0]->field_value;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,11 @@ class ProfileDetailSettingsAction extends SettingsAction
|
|||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
$profile = $cur->getProfile();
|
$profile = $cur->getProfile();
|
||||||
|
|
||||||
$widget = new ExtendedProfileWidget($this, $profile, ExtendedProfileWidget::EDITABLE);
|
$widget = new ExtendedProfileWidget(
|
||||||
|
$this,
|
||||||
|
$profile,
|
||||||
|
ExtendedProfileWidget::EDITABLE
|
||||||
|
);
|
||||||
$widget->show();
|
$widget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,8 +158,6 @@ class ProfileDetailSettingsAction extends SettingsAction
|
|||||||
*/
|
*/
|
||||||
function saveStandardProfileDetails($user)
|
function saveStandardProfileDetails($user)
|
||||||
{
|
{
|
||||||
$user->query('BEGIN');
|
|
||||||
|
|
||||||
$fullname = $this->trimmed('extprofile-fullname');
|
$fullname = $this->trimmed('extprofile-fullname');
|
||||||
$location = $this->trimmed('extprofile-location');
|
$location = $this->trimmed('extprofile-location');
|
||||||
$tagstring = $this->trimmed('extprofile-tags');
|
$tagstring = $this->trimmed('extprofile-tags');
|
||||||
@ -187,7 +189,7 @@ class ProfileDetailSettingsAction extends SettingsAction
|
|||||||
|| $location != $profile->location
|
|| $location != $profile->location
|
||||||
|| !empty($newTags)
|
|| !empty($newTags)
|
||||||
|| $bio != $profile->bio) {
|
|| $bio != $profile->bio) {
|
||||||
|
|
||||||
$orig = clone($profile);
|
$orig = clone($profile);
|
||||||
|
|
||||||
$profile->nickname = $user->nickname;
|
$profile->nickname = $user->nickname;
|
||||||
@ -229,7 +231,6 @@ class ProfileDetailSettingsAction extends SettingsAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->query('COMMIT');
|
|
||||||
Event::handle('EndProfileSaveForm', array($this));
|
Event::handle('EndProfileSaveForm', array($this));
|
||||||
common_broadcast_profile($profile);
|
common_broadcast_profile($profile);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user