Overview

This module aims to provide a vCard attachment for views in a similar way as the views built-in feeds system does.

The existing vCards modules vCard and vCard Field work with either Profile2 data, or data the user has to enter himself. There was however no solution for websites that use Drupal Core's user fields. This module attempts to fill that gap, and is able to turn a user, node (or any other entity) into a vCard.

Basic concepts

This module is based on the way the views module builds RSS and XML feeds. By selecting several fields from a (user) entity and assigning them to specific vCard fields, a complete vCard can be constructed.
When the view contains one vCard, it is delivered as it is. When a view contains multiple vCards, they get zipped before the download starts. This also works for exposed filters.

For the 3.0.0 branch I've tried to stick as much as possible to the vCard 4.0 standard. If you however want to use the 3.0 or 2.1 standards for compatibility reasons, you are able to override the views-vcards-view-row-vcard.html.twig template and make changes where needed.

Installation

Install this module using composer to also get the right zipping library.

Configuration

  1. Create or edit a View showing users (any entity will do, but users make the most sense), then create a new display of type 'vCard'. In this display choose vCards for both 'Format' and 'Show'. The Show settings dialog will allow you to select what user field should be used for each vCard property.
    • Make sure the fields you want to use are added in the fields section,
      otherwise they will not show up.
  2. Views vCards offers the 'attach to' option under vCard settings, allowing this module to add a download link to another display. You can for instance set up your user list view as normal with all (exposed) filters if you require them, attach the vCard display to this and the vCard export will adapt to the set filters and provide the right vCards.

Be careful with the display of usernames in vCards as it could lead to information disclosure.

Known issues

  1. Since Drupal 9.2 there is a permission to allow users to view other user's email addresses. Please refer to this change record: https://www.drupal.org/node/3070293. Having the permission disabled makes that no email addresses are included in vCards. Alternatively you can choose not to use the user's system mail address and use a separate field for it instead.

Dependencies (Drupal 7)

Project information

Releases