| 1 |
<?php |
<?php |
| 2 |
// $Id: profile_pages.module,v 1.5 2007/10/22 21:57:46 jrbeeman Exp $ |
// $Id: profile_pages.module,v 1.4.2.1 2007/10/22 22:07:43 jrbeeman Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_perm |
* Implementation of hook_perm |
| 33 |
function profile_pages_view($name = null) { |
function profile_pages_view($name = null) { |
| 34 |
// If the field name is provided, show all the entries for all the users |
// If the field name is provided, show all the entries for all the users |
| 35 |
if ($name) { |
if ($name) { |
| 36 |
$sql = "SELECT u.uid, u.name, pv.value FROM {users} u, {profile_values} pv, {profile_fields} pf WHERE u.uid = pv.uid AND u.status = 1 AND pf.name = '%s' AND pv.fid = pf.fid AND pv.value != '' ORDER BY u.name ASC"; |
$sql = "SELECT u.uid, u.name, pv.value FROM {users} u, {profile_values} pv, {profile_fields} pf WHERE u.uid = pv.uid AND u.status = 1 AND pf.name = '%s' AND pv.fid = pf.fid AND pv.value != '' AND pf.visibility != %d AND pf.visibility != %d ORDER BY u.name ASC"; |
| 37 |
$result = pager_query($sql, 50, 0, NULL, check_plain($name)); |
$result = pager_query($sql, 50, 0, NULL, check_plain($name), PROFILE_PRIVATE, PROFILE_HIDDEN); |
| 38 |
while ($row = db_fetch_object($result)) { |
while ($row = db_fetch_object($result)) { |
| 39 |
if ($row->value) { |
if ($row->value) { |
| 40 |
$output .= theme('profile_page_listing', $row, $row->value); |
$output .= theme('profile_page_listing', $row, $row->value); |
| 46 |
|
|
| 47 |
// If no field name is provided, show a list of profile fields |
// If no field name is provided, show a list of profile fields |
| 48 |
else { |
else { |
| 49 |
$result = db_query("SELECT fid, name, title from {profile_fields} ORDER BY name"); |
$sql = "SELECT fid, name, title from {profile_fields} WHERE visibility != %d AND visibility != %d ORDER BY name"; |
| 50 |
|
$result = db_query($sql, PROFILE_PRIVATE, PROFILE_HIDDEN); |
| 51 |
$items = array(); |
$items = array(); |
| 52 |
while ($row = db_fetch_object($result)) { |
while ($row = db_fetch_object($result)) { |
| 53 |
$items[] = l($row->title, 'profile_pages/'.$row->name); |
$items[] = l($row->title, 'profile_pages/'.$row->name); |