Avoid wrong email adresses and log these to dblog

This Cookbook shows, how you can avoid to import a user in case of errors in the e-mail address and then to add a notice in the drupal error-log (dblog). It adds this behavior to the module A Wusel Migration (http://drupal.org/node/1285276).

Profile2 and Views

The Profile2 module integrates with Views to allow listing of users with their profile information.

While you can create views directly using the a Profiles type view, most views will start with a User type view. To add Profile2 fields to a User view, you need to add a relationship for User: Profile.

Theming with Profile2


If you are designing a custom template for your user profile pages and are using the Profile2 module, you probably are looking to add your custom fields to the user-profile.tpl.php template. Here is how this can be accomplished.

This assumes that you have a Profile2 profile type called my-profile. You may easily load your fields into your custom user-profile.tpl.php by printing them like this:

Community Media Profile

The Community Media Profile module builds upon the out-the-box profile provided in Drupal core and requires Profile2.

It adds a Public Profile section that includes fields for social media (Facebook, Twitter, LinkedIn, and Other) and a text area for a Bio.

It is designed to work with the Community Media Theme.

Module Dependencies

  • CiviCRM
  • Features
  • Link
  • Profile2
  • Views
  • Chaos Tools


In order for the Community Media Profile to work the following needs to occur when the Community Media Profile module is installed OR when the Community Media Theme is updated.

  1. At the command line, go to profile directory...profiles/[your_starterkit]/modules/contrib-cm/cm_profile/templates
  2. Copy user-profile.tpl.php to the Community Media Theme templates directory
  3. The directory is at . . ./sites/all/themes/cm_theme/[name-of-your-theme]/templates
  4. You will likely need to clear the cache

If you update the Community Media Theme, you'll find that its templates directory removes the user-profile.tpl.php file.

Configuration and Use

Add a translation

This Cookbook shows, how you can add a translation of the module A Wusel Migration (http://drupal.org/node/1285276).

Import new users and their Profile2 fields from one CSV file

This Cookbook shows, how you import one CSV file into a Drupal 7 site, creating new users, each with Profile2 fields.

The trick is to create two separate migrations from one source. The first creates the users, the second creates the profiles.

The second migration connects up the profiles it creates with the users that now exist by mapping the source unique key, MID, to the user uid. This is achieved by applying the line
$this->addFieldMapping('uid', 'MID')
to the code.

The intention of this cookbook is, with detailed notes on this page and comments in the code to explain the function of each component of this migration as a working demo. For your first try use a fresh installed 'drupal 7 with default profile' and then start with step 1.

Subscribe with RSS Subscribe to RSS - profile2