- $contacts = DBA::select('contact', ['uid', 'id'], ['nurl' => normalise_link($url)]);
+ // Fetch the type and match it with the contact type
+ $contact_types = array_keys(ActivityPub::ACCOUNT_TYPES, $apcontact['type']);
+ if (!empty($contact_types)) {
+ $contact_type = array_pop($contact_types);
+ if (is_int($contact_type)) {
+ $contact_fields['contact-type'] = $contact_type;
+
+ // Resetting the 'forum' and 'prv' field when it isn't a forum
+ if ($contact_fields['contact-type'] != Contact::ACCOUNT_TYPE_COMMUNITY) {
+ $contact_fields['forum'] = false;
+ $contact_fields['prv'] = false;
+ }
+ }
+ }
+
+ DBA::update('contact', $contact_fields, ['nurl' => Strings::normaliseLink($url)]);
+
+ $contacts = DBA::select('contact', ['uid', 'id'], ['nurl' => Strings::normaliseLink($url)]);