summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Drumm2008-11-15 02:43:55 (GMT)
committer Neil Drumm2008-11-15 02:43:55 (GMT)
commit09fbf9e4f3fa041f0fdb6f957806abba9317c696 (patch)
tree7164fd57007253b70f3214d0629d69820e8256b6
parentbaea9608111c1e963c3287b3955be28291b0b3c7 (diff)
#123556 by maartenvg and dvdweide. Do not show empty user info categories.
-rw-r--r--modules/profile/profile.module10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index 535a12a..2394e68 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -750,7 +750,15 @@ function profile_validate_profile($edit, $category) {
}
function profile_categories() {
- $result = db_query("SELECT DISTINCT(category) FROM {profile_fields}");
+ // Hide hidden profile fields from users that don't have permission to administer users.
+ // For these users, categories with only hidden profile fields will not be returned.
+ if (user_access('administer users')) {
+ $result = db_query("SELECT DISTINCT(category) FROM {profile_fields}");
+ }
+ else {
+ $result = db_query("SELECT DISTINCT(category) FROM {profile_fields} WHERE visibility <> %d", PROFILE_HIDDEN);
+ }
+
while ($category = db_fetch_object($result)) {
$data[] = array('name' => $category->category, 'title' => $category->category, 'weight' => 3);
}