1

I have a profile created using profile2 module. I want this profile to be rendered as a separate page and I have done so using views. The profile can be viewed in a url: www.example.com/application/authors/username.

I want to provide to the owner of the profile a tab on the page for editing it.

This should be simple using hook_menu, but it doesn't seem to work for me.


function MY_MODULE_menu() {
  $items['application/authors/%author/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('profile2', 1),
    'access callback' => 'MY_MODULE_access_check',
    'access arguments' => array(1),
    'type' => MENU_LOCAL_TASK,
  );

  return $items;
}

Is the above code correct? Do I need to register the view as a parent tab?

1
  • Just figured out the answer below through using Profile2 Pages module. Still if somebody knows how this could be done with views/hook_menu that would be useful for me to know for similar situations and I would vote it as the correct answer over mine. Jul 2, 2013 at 23:27

1 Answer 1

1

Profile2 provides a submodule Profile2 pages which does exactly that: allows the ability to render the profile separately and includes an Edit tab.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.