Posted by Grooviak on August 2, 2007 at 7:34pm
Jump to:
| Project: | Usernode |
| Version: | 5.x-1.2 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Is there a direct URL to edit the users own usernode? It would be very helpful if there could be added a link like usernode/edit to reach the nodes edit page. If it's not possible, it would be a very nice feature.
Comments
#1
You can do this easily in a custom module by adding a menu item in hook_menu like:
<?php
global $user;
$items = array();
$admin_access = user_access('administer users');
// Control logic from user module
if (!$may_cache) {
if (arg(0) == 'user' && is_numeric(arg(1)) && arg(1) > 0) {
$account = user_load(array('uid' => arg(1)));
// This adds a menu item to edit the usernode
$items[] = array('path' => 'user/'. arg(1) .'/profile', 'title' => t('Edit profile'),
'callback' => 'drupal_get_form', 'callback arguments' => array(USERNODE_CONTENT_TYPE .'_node_form', usernode_get_node($account)),
'access' => $admin_access || $user->uid == arg(1), 'type' => MENU_LOCAL_TASK, 'weight' => -5);
}
}
?>
While we could add this to usernode module I am not sure if many people are using it in this way...
#2
thanks grugnog for sharing - I leave this open so that it's visible for others.