diff -u b/lib/Drupal/profile2/Profile.php b/lib/Drupal/profile2/Profile.php --- b/lib/Drupal/profile2/Profile.php +++ b/lib/Drupal/profile2/Profile.php @@ -29,6 +29,13 @@ public $type; /** + * The profile label. + * + * @var string + */ + public $label; + + /** * The user id of the profile owner. * * @var integer @@ -67,7 +74,12 @@ * Overrides Drupal\Core\Entity\Entity::label(). */ public function label($langcode = NULL) { - return entity_load('profile2_type', $this->type)->label($langcode); + if (isset($this->label) && $this->label !== '') { + return $this->label; + } + else { + return entity_load('profile2_type', $this->type)->label($langcode); + } } } reverted: --- b/lib/Drupal/profile2/ProfileFormController.php +++ a/lib/Drupal/profile2/ProfileFormController.php @@ -20,6 +20,10 @@ protected function actionsElement(array $form, array &$form_state) { $element = parent::actionsElement($form, $form_state); + if (!user_access('administer profiles')) { + unset($element['delete']); + } + return $element; } @@ -36,16 +40,6 @@ else { drupal_set_message(t("%name's profile has been updated.", array('%name' => user_format_name(user_load($profile->uid))))); } - - $uri = $profile->uri(); - $form_state['redirect'] = array($uri['path'], $uri['options']); - } - - /** - * Overrides Drupal\Core\Entity\EntityFormController::delete(). - */ - public function delete(array $form, array &$form_state) { - // @todo Add delete confirmation form. } } reverted: --- b/profile2.install +++ a/profile2.install @@ -51,6 +51,13 @@ 'default' => NULL, 'description' => "The {users}.uid of the associated user.", ), + 'label' => array( + 'description' => 'A human-readable label for this profile.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), 'created' => array( 'description' => 'The Unix timestamp when the profile was created.', 'type' => 'int', diff -u b/profile2.module b/profile2.module --- b/profile2.module +++ b/profile2.module @@ -640,0 +641,10 @@ + +/** + * Entity metadata callback to load profiles for the given user account. + */ +function profile2_user_get_properties($account, array $options, $name) { + // Remove the leading 'profile_' from the property name to get the type name. + $profile = profile2_load_by_user($account, substr($name, 8)); + return $profile ? $profile : NULL; +} +