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.
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