Comments

aidanlis’s picture

It's not planned, and no work has started on this yet.

aidanlis’s picture

Status: Active » Fixed

http://drupal.org/project/rel should take care of this for D7.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

raulmuroc’s picture

Title: Port to Drupal 7 » One page profile - Port to Drupal 7 - Port to D7
Status: Closed (fixed) » Active

Let's create a 7.x branch and Port it.

If you cannot port if, please just create the branch and I will work on a patch.

It is a really useful module and REL module doesn't do it at all.

Thanks in advance.

pianomansam’s picture

I agree. Even if Rel module could do this, it is overkill.

kika’s picture

Any update on this?

aidanlis’s picture

I've made a really superficial attempt at porting this, it doesn't work, but it should be simple enough for someone to fill in the gaps I've left. I've enabled the -dev releases for 7.x.

If someone wants to take this on, let me know and I can help out.

maximer’s picture

Any idea when this module will be available for D7?

aidanlis’s picture

Whenever someone steps up to help - I don't have time to do it myself at the moment :(

maximer’s picture

I'm not really a developper but I found this solution: http://www.jide.fr/english/add-profile2-form-directly-on-the-user-edit-form.
Here is the code again:

/**
  * Implements hook_menu_alter().
  */
function YOUR_MODULE_menu_alter(&$items) {
  $items['user/%user_category/edit/your_custom_profile']['access callback'] = FALSE;
}

/**
  * Implements hook_form_FORM_ID_alter() for the user edit form.
  */
function YOUR_MODULE_form_user_profile_form_alter(&$form, &$form_state) { 

  if (($type = profile2_get_types('your_custom_profile')) && $type->userCategory) {
  
    if (empty($form_state['profiles'])) {
      $profile = profile2_load_by_user($form['#user'], 'profile'); 
      
      if (empty($profile)) {
        $profile = profile_create(array('type' => 'your_custom_profile', 'uid' => $form['#user']->uid));
      } 
      
      $form_state['profiles'][$profile->type] = $profile;
    }
    profile2_attach_form($form, $form_state);
    
  }
    
}

Works perfectly except the fact that the values are not stored in the form when you are coming back.

I'm not really porting the module One page Profile, it's only a custom module that I created because I really need this feature on my actual project right now. But it can of course help to port the module to D7.

pianomansam’s picture

Version: 6.x-1.9 » 7.x-1.x-dev

@maximer I appreciate you finding this and posting it here. It's good code and very similar to how Profile2 displays its fields on the user registration form. In Drupal 7, the core profile module is deprecated, which caused the authors of Profile2 to do their work. One Page Profile worked with the core profile module in Drupal 6. I would think we should probably keep it as such, and allow a different effort to support such a thing for Profile2.

aidanlis’s picture

Onepageprofile will support Profile2 and any other contributed module that is feasable. Thanks for the snippet maximer .. hopefully someone takes up the challenge.

maximer’s picture

About my snippet in comment #10, can you tell me why my stored values are not visible in my input fields?
After I saved my form and came back on the form, all the input fields are still empty. Thanks.

aidanlis’s picture

Look at the profile2_load_by_user function.

maximer’s picture

Oh, thanks. My Profile type name was wrong. Everything fine now ;)

intrafusion’s picture

Would love to see this fully working for D7, but there is a substantial problem, the user_profile_form call in onepageprofile.module on line 234 is using the wrong arguments.

The call has changed from user_profile_form($form_state, $account, $category = 'account'); in D6 to user_profile_form($form, &$form_state, $account, $category = 'account'); in D7.

I'm happy to help out with a fix, but I'm not sure where to start as the call to that function is trying to create the $form variable

oliver huynh’s picture

StatusFileSize
new2.82 KB

I added some basic integration with profile2, tested well but I couldn't commit my changes due to GIT denying.

oliver huynh’s picture

Log
==============
git.exe push -v --progress "origin" 7.x-1.x:7.x-1.x

Pushing to http://git.drupal.org/project/onepageprofile.git
error: Cannot access URL http://git.drupal.org/project/onepageprofile.git/, return code 22
fatal: git-http-push failed
==============

aidanlis’s picture

oliverhuynh why would you be able to push to the git repository? can you provide a patch please ...

oliver huynh’s picture

StatusFileSize
new6.76 KB

Hi aidanlis,

Patch is attached.

kenneth.venken’s picture

StatusFileSize
new6.55 KB

I've improved the patch in #20 a bit by adding support for Profile2 permissions.

The only changes between #20 en #21 are

-    $types = profile2_get_types();
-    foreach (array_keys($types) as $type_name) {
-      if (($type = profile2_get_types($type_name)) && $type->userCategory) {
+    foreach (profile2_get_types() as $type_name => $type) {
+      if ($type->userCategory && profile2_access('edit', $type)) {
c4rl’s picture

Status: Active » Needs review
StatusFileSize
new7.09 KB

I don't really see how onepageprofile_user_update() is necessary, seems like profile2.module handles saving. Correct me if I'm wrong.

I updated hook_menu_alter() to take care of the sub-nav.

c4rl’s picture

StatusFileSize
new7.14 KB

Looks like the API for checking profile perms changed.

c4rl’s picture

Title: One page profile - Port to Drupal 7 - Port to D7 » Port to Drupal 7

Less redundant title. :)

blackcat8202’s picture

Can you help me? I don't know how to use this module.
I have installed and activate it, but nothing has changed.
May be I must something write in template.php?