--- /root/drupal-4.5.0/modules/profile.module Sat Oct 16 11:59:59 2004 +++ profile.module Mon Nov 8 17:29:44 2004 @@ -12,6 +12,7 @@ define('PROFILE_PRIVATE', 1); define('PROFILE_PUBLIC', 2); define('PROFILE_PUBLIC_LISTINGS', 3); +define('PROFILE_HIDDEN',4); /** * Implementation of hook_help(). @@ -213,10 +214,10 @@ // 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} ORDER BY category, weight'); + $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d ORDER BY category, weight', PROFILE_HIDDEN); } else { - $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d ORDER BY category, weight', PROFILE_PRIVATE); + $result = db_query('SELECT * FROM {profile_fields} WHERE visibility != %d AND visibility != %d ORDER BY category, weight', PROFILE_PRIVATE, PROFILE_HIDDEN); } while ($field = db_fetch_object($result)) { @@ -247,10 +248,10 @@ function profile_form_profile($edit, $user, $category) { if (($_GET['q'] == 'user/register') ? 1 : 0) { - $result = db_query('SELECT * FROM {profile_fields} WHERE register = 1 ORDER BY category, weight'); + $result = db_query('SELECT * FROM {profile_fields} WHERE register = 1 AND visibility != %d ORDER BY category, weight', PROFILE_HIDDEN); } else { - $result = db_query("SELECT * FROM {profile_fields} WHERE LOWER(category) = '%s' ORDER BY weight", strtolower($category)); + $result = db_query("SELECT * FROM {profile_fields} WHERE LOWER(category) = '%s' AND visibility != %d ORDER BY weight", strtolower($category), PROFILE_HIDDEN); } $fields = array(); @@ -507,7 +508,7 @@ $group .= form_textarea(t('Selection options'), 'options', $edit['options'], 70, 8, t('A list of all options. Put each option on a separate line. Example options are "red", "blue", "green", etc.')); } $group .= form_weight(t('Weight'), 'weight', $edit['weight'], 5, t('The weights define the order in which the form fields are shown. Lighter fields "float up" towards the top of the category.')); - $group .= form_radios(t('Visibility'), 'visibility', $edit['visibility'], array(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.'))); + $group .= form_radios(t('Visibility'), 'visibility', $edit['visibility'], 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.'))); if ($type == 'selection' || $type == 'list') { $group .= form_textfield(t('Page title'), 'page', $edit['page'], 70, 128, t('The title of the page showing all users with the specified field. The word %value will be substituted with the corresponding value. An example page title is "People whose favorite color is %value". Only applicable if the field is configured to be shown on member list pages.')); }