[Suggestion] Adding custom attributes to contacts (programatically)

We would like to add several custom attributes to contacts.
For example linking a contact with the userid of an user, so he could edit his own contact details directly in his profile (But he won’t be allowed to change other users contact details).
How difficult would that be?
We’d need to change the templates for contact details and for user profiles, which shouldn’t be to difficult I guess.
What about storing the new attributes?
Those new attributes wouldn’t necessarily need to be synchronized over carddav (it would be only a nice to have).

And the whole thing in a way, that it would be easy to updated it when new nextcloud versions come out.
(if anybody would be interested in the work, we’d also publish it on github).

1 Like

We Would be interested too in adding custom fields to contacts.
I tried adding it directly in a one-user vcard file, but that field is not shown in nextcloud-contacts after the import.
Is there a working mechanism for that task?
It would be nice if it was possible to have that custom fields synchronised with at least cardbook in thunderbird.

1 Like

I guess there should be somewhere a class or an array which defines which attributes nextcloud knows.
Unfortunately the template for contact editing is the usual mess where you have no idea where the different variables are coming from without looking further into the whole system. (It doesn’t help that it seems that some of the functionality for contacts is in the contacts app, and some is in the core).
I should be able to tell you more, once I start implementing the whole thing.

1 Like

Hello,
I am looking for the same thing. Custom contact fields would be very useful for me.
Any news about this implementation?
Thanks!

1 Like

DISCLAIMER: The Contacts app may have changed since I maintained it.

Storing the attribute for linking it to a userprofile in the VCard is not recommended. All attributes are saved losslessly when importing or adding a contact, so a user could create a specially crafted VCard and get access to other contacts in the database table.

An other way would be to somehow expose the actual ID in the database (of course without exposing it to the user) and link contact and user profile that way.

Hi! Is there anything new on this? We’re thinking about switching to nextcloud, but we use userfields for quite a lot of things and we really need to keep that data. Thanks!

1 Like

Custom properties are and will not be supported.
If you want to fill custom data, there is the NOTE property for this exact purpose :slight_smile:

1 Like

Okay, thanks for the insanly fast answer! I’ll look into that. Thanks!

@skjnldsv,

How do you know that they shall not be, and why? Even contacts/README.md at 73ef6e258f363a9bf7f44cd0e79bdff0b44450b4 · nextcloud/contacts · GitHub is merely an indication that some item types would be difficult, rather than a ban on all new ones.

I ask because Ability to have custom labels · Issue #27 · nextcloud/contacts · GitHub doesn’t provide this functionality - it’s per-contact rather than a common preset which the server understands as not being per-contact.

However, it obviously does not fullfil that purpose. Potentially, it could be close if the user stored pure JSON in their notes, but that’s unreasonable.