<?php
// $Id$
function readonly_menu() {
$items['admin/settings/readonly'] =
array(
'title' =>
t('Read Only'),
'description' =>
t('Which profile fields'),
'page callback' => 'drupal_get_form',
'page arguments' =>
array('readonly_admin_settings'),
'access arguments' =>
array('access administration pages'),
);
return $items;
}
function readonly_perm(){
return array('edit read only profile fields');
}
function readonly_admin_settings() {
'#type' => 'fieldset',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
);
$result =
db_query("SELECT pf.name, pf.title, pf.category FROM {profile_fields} pf");
$name = $row->name;
$title = $row->title;
$category = $row->category;
$form['fields'][$category]['set_' .
$name .
''] =
array(
'#type' => 'checkbox',
'#title' => $title,
);
}
}
function readonly_form_alter(&$form, $form_state, $form_id) {
if ($form_id != 'user_register') {
$result =
db_query("SELECT pf.name, pf.category FROM {profile_fields} pf");
$name = $row->name;
$category = $row->category;
$form[$category][$name]['#disabled'] = TRUE;
}
}
}
}
}