]> git.mxchange.org Git - friendica.git/blobdiff - include/user.php
Merge pull request #480 from pixelroot/master
[friendica.git] / include / user.php
index 383a3b3e1cf76fe7a9ba484b5443d7e9c2071130..282bbdbba24761acc46d6a9bfeb78b25cf725678 100644 (file)
@@ -99,11 +99,11 @@ function create_user($arr) {
 
 
        if(! allowed_email($email))
-                       $result['message'] .= t('Your email domain is not among those allowed on this site.') . EOL;
+               $result['message'] .= t('Your email domain is not among those allowed on this site.') . EOL;
 
        if((! valid_email($email)) || (! validate_email($email)))
                $result['message'] .= t('Not a valid email address.') . EOL;
-
+               
        // Disallow somebody creating an account using openid that uses the admin email address,
        // since openid bypasses email verification. We'll allow it if there is not yet an admin account.
 
@@ -277,6 +277,26 @@ function create_user($arr) {
                require_once('include/group.php');
                group_add($newuid, t('Friends'));
 
+               $r = q("SELECT id FROM `group` WHERE uid = %d AND name = '%s'",
+                       intval($newuid),
+                       dbesc(t('Friends'))
+               );
+               if($r && count($r)) {
+                       $def_gid = $r[0]['id'];
+
+                       q("UPDATE user SET def_gid = %d WHERE uid = %d",
+                               intval($r[0]['id']),
+                               intval($newuid)
+                       );
+               }
+
+               if(get_config('system', 'newuser_private') && $def_gid) {
+                       q("UPDATE user SET allow_gid = '%s' WHERE uid = %d",
+                          dbesc("<" . $def_gid . ">"),
+                          intval($newuid)
+                       );
+               }
+
        }
 
        // if we have no OpenID photo try to look up an avatar