]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/profilesettings.php
Merge branch 'master' of git.gnu.io:gnu/gnu-social into mmn_fixes
[quix0rs-gnu-social.git] / actions / profilesettings.php
index 5804f21ca59d817d37642a3ccea537d5b6bdd607..a1d947530c6b284ee59a3e230d061dfbcbed91dd 100644 (file)
@@ -110,7 +110,10 @@ class ProfilesettingsAction extends SettingsAction
             $this->elementStart('li');
             // TRANS: Field label in form for profile settings.
             $this->input('fullname', _('Full name'),
-                         $this->trimmed('fullname') ?: $this->scoped->getFullname());
+                         $this->trimmed('fullname') ?: $this->scoped->getFullname(),
+                         // TRANS: Instructions for full name text field on profile settings
+                         _('A full name is required, if empty it will be set to your nickname.'),
+                         null, true);
             $this->elementEnd('li');
             $this->elementStart('li');
             // TRANS: Field label in form for profile settings.
@@ -204,13 +207,15 @@ class ProfilesettingsAction extends SettingsAction
                             (empty($user->subscribe_policy)) ? User::SUBSCRIBE_POLICY_OPEN : $user->subscribe_policy);
             $this->elementEnd('li');
         }
-        $this->elementStart('li');
-        $this->checkbox('private_stream',
-                        // TRANS: Checkbox label in profile settings.
-                        _('Make updates visible only to my followers'),
-                        ($this->arg('private_stream')) ?
-                        $this->boolean('private_stream') : $user->private_stream);
-        $this->elementEnd('li');
+        if (common_config('profile', 'allowprivate') || $user->private_stream) {
+            $this->elementStart('li');
+            $this->checkbox('private_stream',
+                            // TRANS: Checkbox label in profile settings.
+                            _('Make updates visible only to my followers'),
+                            ($this->arg('private_stream')) ?
+                            $this->boolean('private_stream') : $user->private_stream);
+            $this->elementEnd('li');
+        }
         $this->elementEnd('ul');
         // TRANS: Button to save input in profile settings.
         $this->submit('save', _m('BUTTON','Save'));
@@ -252,7 +257,6 @@ class ProfilesettingsAction extends SettingsAction
             $location = $this->trimmed('location');
             $autosubscribe = $this->booleanintstring('autosubscribe');
             $subscribe_policy = $this->trimmed('subscribe_policy');
-            $private_stream = $this->booleanintstring('private_stream');
             $language = $this->trimmed('language');
             $timezone = $this->trimmed('timezone');
             $tagstring = $this->trimmed('tags');
@@ -307,6 +311,15 @@ class ProfilesettingsAction extends SettingsAction
             $user = $this->scoped->getUser();
             $user->query('BEGIN');
 
+            // Only allow setting private_stream if site policy allows it
+            // (or user already _has_ a private stream, then you can unset it)
+            if (common_config('profile', 'allowprivate') || $user->private_stream) {
+                $private_stream = $this->booleanintstring('private_stream');
+            } else {
+                // if not allowed, we set to the existing value
+                $private_stream = $user->private_stream;
+            }
+
             // $user->nickname is updated through Profile->update();
 
             // XXX: XOR
@@ -345,7 +358,7 @@ class ProfilesettingsAction extends SettingsAction
                 $this->scoped->nickname = $nickname;
                 $this->scoped->profileurl = common_profile_url($this->scoped->getNickname());
             }
-            $this->scoped->fullname = $fullname;
+            $this->scoped->fullname = (mb_strlen($fullname)>0 ? $fullname : $this->scoped->nickname);
             $this->scoped->homepage = $homepage;
             $this->scoped->bio = $bio;
             $this->scoped->location = $location;