? files ? profile_internal.module.patch ? sites/here.be.dragons.rtk0.net Index: modules/profile/profile.module =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v retrieving revision 1.219 diff -u -p -r1.219 profile.module --- modules/profile/profile.module 5 Sep 2007 18:11:27 -0000 1.219 +++ modules/profile/profile.module 10 Sep 2007 16:46:06 -0000 @@ -27,6 +27,11 @@ define('PROFILE_PUBLIC_LISTINGS', 3); define('PROFILE_HIDDEN', 4); /** + * Hidden profile field, only accessible by modules and themes. + */ +define('PROFILE_INTERNAL', 5); + +/** * Implementation of hook_help(). */ function profile_help($path, $arg) { @@ -301,7 +306,7 @@ Unless you know what you are doing, it i $form['fields']['visibility'] = array('#type' => 'radios', '#title' => t('Visibility'), '#default_value' => isset($edit['visibility']) ? $edit['visibility'] : PROFILE_PUBLIC, - '#options' => array(PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')), + '#options' => array(PROFILE_INTERNAL => t('Internal profile field, not accessible by any user.'), PROFILE_HIDDEN => t('Hidden profile field, only accessible by administrators, modules and themes.'), PROFILE_PRIVATE => t('Private field, content only available to privileged users.'), PROFILE_PUBLIC => t('Public field, content shown on profile page but not used on member list pages.'), PROFILE_PUBLIC_LISTINGS => t('Public field, content shown on profile page and on member list pages.')), ); if ($type == 'selection' || $type == 'list' || $type == 'textfield') { $form['fields']['page'] = array('#type' => 'textfield', @@ -631,10 +636,10 @@ function profile_view_profile(&$user) { // Show private fields to administrators and people viewing their own account. if (user_access('administer users') || $GLOBALS['user']->uid == $user->uid) { - $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d ORDER BY category, weight', PROFILE_HIDDEN); + $result = db_query('SELECT * FROM {profile_fields} WHERE visibility NOT IN (%d,%d) ORDER BY category, weight', PROFILE_HIDDEN, PROFILE_INTERNAL); } else { - $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d AND visibility != %d ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN); + $result = db_query('SELECT * FROM {profile_fields} WHERE visibility NOT IN (%d,%d,%d) ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN, PROFILE_INTERNAL); } $fields = array(); @@ -795,7 +800,7 @@ function profile_validate_profile($edit, } function profile_categories() { - $result = db_query("SELECT DISTINCT(category) FROM {profile_fields}"); + $result = db_query("SELECT DISTINCT(category) FROM {profile_fields} WHERE visibility != %d;",PROFILE_INTERNAL); $data = array(); while ($category = db_fetch_object($result)) { $data[] = array('name' => $category->category, 'title' => $category->category, 'weight' => 3); @@ -897,6 +902,10 @@ function _profile_get_fields($category, $args[] = $category; } if (!user_access('administer users')) { + $filters[] = 'visibility NOT IN (%d,%d)'; + $args[] = PROFILE_HIDDEN; + $args[] = PROFILE_INTERNAL; + } else { $filters[] = 'visibility != %d'; $args[] = PROFILE_HIDDEN; }