- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
<?php
function test_menu() {
// $menu['test'] = array(
// 'page callback' => 'test_page',
// 'access callback' => TRUE,
// );
$menu['test/%user_uid_optional'] = array(
'page callback' => 'test_view',
'page arguments' => array(1),
'access callback' => 'test_access',
'access arguments' => array(1),
);
$menu['test/%user/view'] = array(
'title' => 'View',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$menu['test/%user/edit'] = array(
'title' => 'Edit',
'page callback' => 'test_edit',
'page arguments' => array(1),
'access callback' => 'test_access',
'access arguments' => array(1),
'type' => MENU_LOCAL_TASK,
);
return $menu;
}
function test_page() {
global $user;
if ($user->uid) {
menu_set_active_item("test/$user->uid");
return menu_execute_active_handler();
}
else {
drupal_goto('user/login');
}
}
function test_view($account) {
module_load_include('pages.inc', 'user');
return user_view($account);
}
function test_edit($account) {
module_load_include('pages.inc', 'user');
return user_edit($account);
}
function test_access($account) {
dpm($account);
return TRUE;
}