forked from GNUsocial/gnu-social
add autosubscribe to profile settings
darcs-hash:20080720202705-84dde-da40ebc8bcb9bd438e891c5a103211ebd67fd2c7.gz
This commit is contained in:
parent
d294c91d82
commit
3ffe57c7e2
@ -52,6 +52,8 @@ class ProfilesettingsAction extends SettingsAction {
|
|||||||
common_input('location', _('Location'),
|
common_input('location', _('Location'),
|
||||||
($this->arg('location')) ? $this->arg('location') : $profile->location,
|
($this->arg('location')) ? $this->arg('location') : $profile->location,
|
||||||
_('Where you are, like "City, State (or Region), Country"'));
|
_('Where you are, like "City, State (or Region), Country"'));
|
||||||
|
common_checkbox('autosubscribe', _('Automatically subscribe to whoever subscribes to me (best for non-humans)'),
|
||||||
|
($this->arg('autosubscribe') : $this->boolean('autosubscribe') : $user->autosubscribe);
|
||||||
common_submit('submit', _('Save'));
|
common_submit('submit', _('Save'));
|
||||||
common_element_end('form');
|
common_element_end('form');
|
||||||
common_show_footer();
|
common_show_footer();
|
||||||
@ -64,6 +66,7 @@ class ProfilesettingsAction extends SettingsAction {
|
|||||||
$homepage = $this->trimmed('homepage');
|
$homepage = $this->trimmed('homepage');
|
||||||
$bio = $this->trimmed('bio');
|
$bio = $this->trimmed('bio');
|
||||||
$location = $this->trimmed('location');
|
$location = $this->trimmed('location');
|
||||||
|
$autosubscribe = $this->boolean('autosubscribe');
|
||||||
|
|
||||||
# Some validation
|
# Some validation
|
||||||
|
|
||||||
@ -115,6 +118,22 @@ class ProfilesettingsAction extends SettingsAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# XOR
|
||||||
|
|
||||||
|
if ($user->autosubscribe ^ $autosubscribe) {
|
||||||
|
$original = clone($user);
|
||||||
|
|
||||||
|
$user->nickname = $nickname;
|
||||||
|
|
||||||
|
$result = $user->update($original);
|
||||||
|
|
||||||
|
if ($result === FALSE) {
|
||||||
|
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||||
|
common_server_error(_('Couldn\'t update user.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$profile = $user->getProfile();
|
$profile = $user->getProfile();
|
||||||
|
|
||||||
$orig_profile = clone($profile);
|
$orig_profile = clone($profile);
|
||||||
|
Loading…
Reference in New Issue
Block a user