Hello,

Thank you for this great module - I have been learning a lot thanks to the great drupal support base and have been able to customize a profile to the needs of the users on my website.

I was wondering if it is possible to render the user's 'account edit input box' on the content profile page?

Could someone please add any suggestions?

Thank you!

Comments

benone’s picture

subscribe

Bilmar’s picture

Thanks for subscribing to show interest =)

To clarify - by 'account edit input boxes' I mean to be able to render the Email, Username etc on the content profile page for user to be able to edit those fields and save the changes.

Thank you

benone’s picture

Yeah, I am lookin for exactly the same functionality :)

finex’s picture

Currently I'm trying to use a rule which redirect from the node edit form to the user account edit form (which has the content profile edit tab)... The solution is not yet working, I need some time to write the correct rule :-p

maria_zk’s picture

Subscribing. I need the same functionality. Generally speaking, is it possible to include other fields from core's user account like e.g. upload picture in the content profile content type?

YK85’s picture

subscribing

nonom’s picture

subscribe

jonhattan’s picture

Here is a solution I'm using and seems to work. It's a reduced version of a custom module (it is called "usuarios", spanish word for users). It has some extra bits I think are useful for consistency and I've tried to document it as clear as possible. Hope it helps.

/**
 * Implementation of hook_perm().
 *
 * Declare a new permission to restrict user page tabs to some users.
 */
function usuarios_perm() {
  return array('view user tabs');
}

/**
 * Implementation of hook_menu_alter().
 *
 * Declare new access control to drupal user's view and edit pages.
 * it will also hide related tabs.
 */
function usuarios_menu_alter(&$items) {
  $items['user/%user/view']['access callback'] = 'user_access';
  $items['user/%user/view']['access arguments'] = array('view user tabs');
  $items['user/%user_category/edit']['access callback'] = 'user_access';
  $items['user/%user_category/edit']['access arguments'] = array('view user tabs');
}

/**
 * Implementation of hook_form_alter().
 */
function usuarios_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'profile_node_form':
      // If user is editing her profile, add password and mail fields.
      if (!is_null($form['nid']['#value'])) {
        global $user;
        $form_state = array();
        // Load drupal user edit form.
        $form2 = user_edit_form($form_state, $form['uid']['#value'], (array)$user);
        // We only want password and email.
        $form['account'] = array();
        $form['account']['mail'] = $form2['account']['mail'];
        $form['account']['pass'] = $form2['account']['pass'];
        // Automagically user fields validation is done (haven't investigated why it happens but it works :))
        // So there's no need to add a custom validation callback.
        //$form['#validate'][] = '_usuarios_account_form_validate';
        // Attach our own submit callback to handle extra fields.
        $form['#submit'][] = '_usuarios_account_form_submit';
      }
      break;
  }
}

/** 
 * Custom submit callback function. We need to save drupal user fields.
 */
function _usuarios_account_form_submit($form, $form_state) {
  global $user;
  $edit = array(
    'pass' => $form_state['values']['pass'],
    'mail' => $form_state['values']['mail'],
  );
  user_save($user, $edit);
}
jonhattan’s picture

Another approach is done in content_profile_registration. I think it can be also used for the use case exposed in this issue.

Pls’s picture

Code from #8 works very well with content profle 1.0, thanks jonhattan!