Mercurial > defr > drupal > core
comparison modules/profile/profile.module @ 5:2427550111ae 6.2
Drupal 6.2
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:30:08 +0100 |
parents | c1f4ac30525a |
children | fff6d4c8c043 |
comparison
equal
deleted
inserted
replaced
4:d94886ac61a0 | 5:2427550111ae |
---|---|
1 <?php | 1 <?php |
2 // $Id: profile.module,v 1.236 2008/02/03 19:36:46 goba Exp $ | 2 // $Id: profile.module,v 1.236.2.1 2008/04/09 21:11:49 goba Exp $ |
3 | 3 |
4 /** | 4 /** |
5 * @file | 5 * @file |
6 * Support for configurable user profiles. | 6 * Support for configurable user profiles. |
7 */ | 7 */ |
93 ); | 93 ); |
94 $items['admin/user/profile/add'] = array( | 94 $items['admin/user/profile/add'] = array( |
95 'title' => 'Add field', | 95 'title' => 'Add field', |
96 'page callback' => 'drupal_get_form', | 96 'page callback' => 'drupal_get_form', |
97 'page arguments' => array('profile_field_form'), | 97 'page arguments' => array('profile_field_form'), |
98 'access arguments' => array('administer users'), | |
98 'type' => MENU_CALLBACK, | 99 'type' => MENU_CALLBACK, |
99 'file' => 'profile.admin.inc', | 100 'file' => 'profile.admin.inc', |
100 ); | 101 ); |
101 $items['admin/user/profile/autocomplete'] = array( | 102 $items['admin/user/profile/autocomplete'] = array( |
102 'title' => 'Profile category autocomplete', | 103 'title' => 'Profile category autocomplete', |
103 'page callback' => 'profile_admin_settings_autocomplete', | 104 'page callback' => 'profile_admin_settings_autocomplete', |
105 'access arguments' => array('administer users'), | |
104 'type' => MENU_CALLBACK, | 106 'type' => MENU_CALLBACK, |
105 'file' => 'profile.admin.inc', | 107 'file' => 'profile.admin.inc', |
106 ); | 108 ); |
107 $items['admin/user/profile/edit'] = array( | 109 $items['admin/user/profile/edit'] = array( |
108 'title' => 'Edit field', | 110 'title' => 'Edit field', |
109 'page callback' => 'drupal_get_form', | 111 'page callback' => 'drupal_get_form', |
110 'page arguments' => array('profile_field_form'), | 112 'page arguments' => array('profile_field_form'), |
113 'access arguments' => array('administer users'), | |
111 'type' => MENU_CALLBACK, | 114 'type' => MENU_CALLBACK, |
112 'file' => 'profile.admin.inc', | 115 'file' => 'profile.admin.inc', |
113 ); | 116 ); |
114 $items['admin/user/profile/delete'] = array( | 117 $items['admin/user/profile/delete'] = array( |
115 'title' => 'Delete field', | 118 'title' => 'Delete field', |
116 'page callback' => 'drupal_get_form', | 119 'page callback' => 'drupal_get_form', |
117 'page arguments' => array('profile_field_delete'), | 120 'page arguments' => array('profile_field_delete'), |
121 'access arguments' => array('administer users'), | |
118 'type' => MENU_CALLBACK, | 122 'type' => MENU_CALLBACK, |
119 'file' => 'profile.admin.inc', | 123 'file' => 'profile.admin.inc', |
120 ); | 124 ); |
121 $items['profile/autocomplete'] = array( | 125 $items['profile/autocomplete'] = array( |
122 'title' => 'Profile autocomplete', | 126 'title' => 'Profile autocomplete', |
451 $data[] = array( | 455 $data[] = array( |
452 'name' => $category->category, | 456 'name' => $category->category, |
453 'title' => $category->category, | 457 'title' => $category->category, |
454 'weight' => 3, | 458 'weight' => 3, |
455 'access callback' => 'profile_category_access', | 459 'access callback' => 'profile_category_access', |
456 'access arguments' => array($category->category) | 460 'access arguments' => array(1, $category->category) |
457 ); | 461 ); |
458 } | 462 } |
459 return $data; | 463 return $data; |
460 } | 464 } |
461 | 465 |
462 /** | 466 /** |
463 * Menu item access callback - check if a user has access to a profile category. | 467 * Menu item access callback - check if a user has access to a profile category. |
464 */ | 468 */ |
465 function profile_category_access($category) { | 469 function profile_category_access($account, $category) { |
466 if (user_access('administer users')) { | 470 if (user_access('administer users') && $account->uid > 0) { |
467 return TRUE; | 471 return TRUE; |
468 } | 472 } |
469 else { | 473 else { |
470 return db_result(db_query("SELECT COUNT(*) FROM {profile_fields} WHERE category = '%s' AND visibility <> %d", $category, PROFILE_HIDDEN)); | 474 return user_edit_access($account) && db_result(db_query("SELECT COUNT(*) FROM {profile_fields} WHERE category = '%s' AND visibility <> %d", $category, PROFILE_HIDDEN)); |
471 } | 475 } |
472 } | 476 } |
473 | 477 |
474 /** | 478 /** |
475 * Process variables for profile-block.tpl.php. | 479 * Process variables for profile-block.tpl.php. |