You are here

function views_megarow_user_page_edit in Views Megarow 7

Wrap the default user edition form.

See also

user_profile_form().

1 string reference to 'views_megarow_user_page_edit'
views_megarow_menu_alter in ./views_megarow.module
Implements hook_menu_alter().

File

./views_megarow.module, line 530

Code

function views_megarow_user_page_edit($form_id, $user) {

  // If the url executing the user edit menu item is from a megarow,
  // let's hook into megarow form rendering instead of the classic
  // output.
  if (preg_match('`^display_megarow/[0-9]+/user/[0-9]+/edit$`', $_GET['q'])) {

    // Add a flag for the user edition form.
    $user->from_megarow = TRUE;
    $output = drupal_get_form('user_profile_form', $user);

    // Instead of return the form, pass it to views megarow to display it.
    return views_megarow_display(t('Edit'), $output, $user->uid);
  }
  else {

    // Otherwise fallback on the default behavior.
    $user->from_megarow = FALSE;
    return drupal_get_form('user_profile_form', $user);
  }
}