X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fuser.php;h=23023abd65122901045c4b11244fe29186951b05;hb=8adc1bd703a6f610296691dabf54c5b8fd0e1699;hp=039b30bbd10ef7eee76be202f58cd5b93e5476cf;hpb=610c78f9e0da9700a3fa3563c560c5dc119aebb8;p=friendica.git diff --git a/include/user.php b/include/user.php index 039b30bbd1..23023abd65 100644 --- a/include/user.php +++ b/include/user.php @@ -7,6 +7,7 @@ require_once('include/text.php'); require_once('include/pgettext.php'); require_once('include/datetime.php'); + function create_user($arr) { // Required: { username, nickname, email } or { openid_url } @@ -59,7 +60,13 @@ function create_user($arr) { $openid->returnUrl = $a->get_baseurl() . '/openid'; $openid->required = array('namePerson/friendly', 'contact/email', 'namePerson'); $openid->optional = array('namePerson/first','media/image/aspect11','media/image/default'); - goaway($openid->authUrl()); + try { + $authurl = $openid->authUrl(); + } catch (Exception $e){ + $result['message'] .= t("We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID."). EOL . EOL . t("The error message was:") . $e->getMessage() . EOL; + return $result; + } + goaway($authurl); // NOTREACHED } @@ -277,6 +284,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