Requests for soapbox and freelove accounts are automatically accepted

This commit is contained in:
Michael Vogel 2015-11-28 01:03:26 +01:00
parent a9b2b48d08
commit 79092f149c

View file

@ -4171,8 +4171,7 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
); );
} }
// send email notification to owner? // send email notification to owner?
} } else {
else {
// create contact record // create contact record
@ -4193,9 +4192,26 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
intval($importer['uid']), intval($importer['uid']),
dbesc($url) dbesc($url)
); );
if(count($r)) if(count($r)) {
$contact_record = $r[0]; $contact_record = $r[0];
$photos = import_profile_photo($photo,$importer["uid"],$contact_record["id"]);
q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d",
dbesc($photos[0]),
dbesc($photos[1]),
dbesc($photos[2]),
intval($contact_record["id"])
);
}
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($importer['uid'])
);
$a = get_app();
if(count($r) AND !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
// create notification // create notification
$hash = random_string(); $hash = random_string();
@ -4209,19 +4225,13 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
); );
} }
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($importer['uid'])
);
$a = get_app();
if(count($r)) {
if(intval($r[0]['def_gid'])) { if(intval($r[0]['def_gid'])) {
require_once('include/group.php'); require_once('include/group.php');
group_add_member($r[0]['uid'],'',$contact_record['id'],$r[0]['def_gid']); group_add_member($r[0]['uid'],'',$contact_record['id'],$r[0]['def_gid']);
} }
if(($r[0]['notify-flags'] & NOTIFY_INTRO) && if(($r[0]['notify-flags'] & NOTIFY_INTRO) &&
in_array($r[0]['page-flags'], array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE))) { in_array($r[0]['page-flags'], array(PAGE_NORMAL))) {
notification(array( notification(array(
'type' => NOTIFY_INTRO, 'type' => NOTIFY_INTRO,
@ -4239,7 +4249,13 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
)); ));
} }
} elseif (count($r) AND in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
$r = q("UPDATE `contact` SET `pending` = 0 WHERE `uid` = %d AND `url` = '%s' AND `pending` LIMIT 1",
intval($importer['uid']),
dbesc($url)
);
} }
} }
} }