diff --git a/README.md b/README.md index 90fe129..dabc75b 100644 --- a/README.md +++ b/README.md @@ -24,16 +24,20 @@ Upgrading from Drupal 7 ----------------------- This module is the successor to the [Drupal 7 Profile2 -module](https://drupal.org/project/profile2) and will automatically import and +module](https://drupal.org/project/profile2) and can automatically import and convert any Profile2 profiles when upgrading from a Drupal 7 installation. -Note that this module does NOT import from the [deprecated Profile +Note that this module does _not_ import from the [deprecated Profile module](https://www.drupal.org/node/874026) that was provided in Drupal 7 core as an upgrade path from Drupal 6 sites that used Profiles. If you have profiles from the Drupal 7 Profile module, you should either convert them to Profile2 profiles in Drupal 7 prior to upgrading to Backdrop, or recreate them in Backdrop after you upgrade. +If you are migrating Drupal 7 Profile2 profiles to Backdrop Profile, you should, +however, _enable_ the Drupal 7 Profile module before preparing the db for +migration. + Documentation ------------- @@ -65,3 +69,4 @@ Credits: * [Wolfgang Ziegler (fago)](https://www.drupal.org/u/fago), nuppla@zites.net * [Joachim Noreiko (joachim)](https://www.drupal.org/u/joachim), joachim.n+backdrop@gmail.com +`` diff --git a/profile.admin.inc b/profile.admin.inc index ace445e..d950a2b 100644 --- a/profile.admin.inc +++ b/profile.admin.inc @@ -27,7 +27,7 @@ function profile_display_settings_form($form, &$form_state) { '#value' => t('Save configuration'), '#weight' => 40, ); - + return $form; } @@ -119,7 +119,7 @@ function profile_type_form($form, &$form_state, $profile_type, $op = 'edit') { '#submit' => array('profile_type_form_submit_delete') ); } - + return $form; } diff --git a/profile.install b/profile.install index bce3c5f..c842a6b 100644 --- a/profile.install +++ b/profile.install @@ -236,3 +236,11 @@ function profile_update_1001() { WHERE name = 'profile2' AND type = 'module'"); } + +/** + * Drop any leftover D7 Profile module tables. + */ +function profile_update_1002() { + db_drop_table('profile_field'); + db_drop_table('profile_value'); +} diff --git a/profile.module b/profile.module index 7f7f72c..9704316 100644 --- a/profile.module +++ b/profile.module @@ -137,10 +137,10 @@ function profile_menu() { ); $items['admin/config/people/profiles'] = array( - 'title' => 'Profile display settings', + 'title' => 'Profile display', 'page callback' => 'backdrop_get_form', 'page arguments' => array('profile_display_settings_form'), - 'description' => 'Profile display settings form.', + 'description' => 'Configure how profile edit forms are displayed when editing accounts.', 'access arguments' => array('administer profile'), 'file' => 'profile.admin.inc', ); @@ -235,7 +235,7 @@ function profile_user_edit_access($account, $type_name) { $profile = profile_load_by_user($account, $type_name); if (empty($profile)) { $profile = profile_create(array('type' => $type_name, 'uid' => $account->uid)); - } + } if (profile_access('edit', $profile, $account)) { return TRUE; } @@ -464,12 +464,12 @@ function profile_type_save($type) { $data = (array) $type; $data += array( - 'userview' => true, + 'userview' => TRUE, 'registration' => 0, 'roles' => array( 'authenticated' => 'authenticated', ), - 'module' => null, + 'module' => NULL, 'weight' => '0', 'storage' => 1, 'status' => 1, @@ -499,7 +499,7 @@ function profile_type_delete($type) { } /** - * Implements hook_profile_type_delete() + * Implements hook_profile_type_delete(). */ function profile_profile_type_delete($type) { $pids = array_keys(profile_load_multiple(FALSE, array('type' => $type->type))); @@ -530,8 +530,8 @@ function profile_user_view($account, $view_mode, $langcode) { /** * Implements hook_form_FORM_ID_alter() for the user edit form. * - * @see profile_form_validate_handler - * @see profile_form_submit_handler + * @see profile_form_validate_handler() + * @see profile_form_submit_handler() */ function profile_form_user_profile_form_alter(&$form, &$form_state, $form_id) { $profile_display = config_get('profile.settings', 'profile_display'); @@ -562,7 +562,7 @@ function profile_form_user_profile_form_alter(&$form, &$form_state, $form_id) { $profile = profile_create(array('type' => $type_name, 'uid' => $form_state['user']->uid)); } $form_state['profiles'][$profile->type] = $profile; - profile_attach_form($form, $form_state); + profile_attach_form($form, $form_state); } } else { @@ -570,10 +570,10 @@ function profile_form_user_profile_form_alter(&$form, &$form_state, $form_id) { $profile = profile_load_by_user($form_state['user'], $type_name); if (empty($profile)) { $profile = profile_create(array('type' => $type_name, 'uid' => $form_state['user']->uid)); - } + } if (profile_access('edit', $profile)) { $form_state['profiles'][$profile->type] = $profile; - profile_attach_form($form, $form_state); + profile_attach_form($form, $form_state); // Wrap each profile form in a fieldset. $form['profile_' . $type_name] += array( '#type' => 'fieldset', @@ -659,7 +659,7 @@ function profile_attach_form(&$form, &$form_state) { // Provide a central place for modules to alter the profile forms, but // skip that in case the caller cares about invoking the hooks. - // @see profile_form(). + // @see profile_form() if (!isset($form_state['profile_skip_hook'])) { $hooks[] = 'form_profile_edit_' . $type . '_form'; $hooks[] = 'form_profile_form'; @@ -1038,6 +1038,9 @@ function profile_user_get_properties($account, array $options, $name) { } +/** + * Return class autoload information. + */ function profile_autoload_info() { return array( 'Profile' => 'profile.entity.inc', @@ -1136,12 +1139,12 @@ function profile_config_info() { */ function profile_type_set_defaults() { $new_type = array( - 'userview' => true, + 'userview' => TRUE, 'type' => '', 'label' => '', 'registration' => 1, 'roles' => array(), - 'module' => null, + 'module' => NULL, 'weight' => 0, 'storage' => PROFILE_STORAGE_NORMAL, 'status' => PROFILE_STATUS_ENABLED,