automatically make posts private for new users

This commit is contained in:
Zach Prezkuta 2012-08-24 21:28:28 -06:00
parent 1b0dd6f2ec
commit 7c5f5f3113
1 changed files with 15 additions and 0 deletions

View File

@ -277,6 +277,21 @@ function create_user($arr) {
require_once('include/group.php');
group_add($newuid, t('Friends'));
if((! isset($a->config['system']['newuser_public'])) || ($a->config['system']['newuser_public'] === 0)) {
// Make the group we just created the default for new contacts and for posts
$r = q("SELECT id FROM `group` WHERE uid = %d AND name = '%s'",
intval($newuid),
dbesc(t('Friends'))
);
if($r) {
q("UPDATE user SET def_gid = %d, allow_gid = '%s' WHERE uid = %d",
intval($r[0]['id']),
dbesc("<" . $r[0]['id'] . ">"),
intval($newuid)
);
}
}
}
// if we have no OpenID photo try to look up an avatar