]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/register.php
make init of lang environment happen earlier, or when user language may have changed
[quix0rs-gnu-social.git] / actions / register.php
index 0832b084786391ce041bfbe28fe9cd30e579e8f8..c539108420095f81da74412f26df49c2fccaf628 100644 (file)
@@ -24,7 +24,9 @@ class RegisterAction extends Action {
        function handle($args) {
                parent::handle($args);
 
-               if (common_logged_in()) {
+               if (common_config('site', 'closed')) {
+                       common_user_error(_('Registration not allowed.'));
+               } else if (common_logged_in()) {
                        common_user_error(_('Already logged in.'));
                } else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                        $this->try_register();
@@ -96,6 +98,8 @@ class RegisterAction extends Action {
                                common_debug('Adding rememberme cookie for ' . $nickname);
                                common_rememberme($user);
                        }
+                       # Re-init language env in case it changed (not yet, but soon)
+                       common_init_language();
                        $this->show_success();
                } else {
                        $this->show_form(_('Invalid username or password.'));
@@ -159,6 +163,20 @@ class RegisterAction extends Action {
                        return FALSE;
                }
 
+               # Everyone is subscribed to themself
+
+               $subscription = new Subscription();
+               $subscription->subscriber = $user->id;
+               $subscription->subscribed = $user->id;
+               $subscription->created = $user->created;
+               
+               $result = $subscription->insert();
+               
+               if (!$result) {
+                       common_log_db_error($subscription, 'INSERT', __FILE__);
+                       return FALSE;
+               }
+               
                if ($email) {
 
                        $confirm = new Confirm_address();