Index: bio/bio.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/bio/bio.info,v retrieving revision 1.1 diff -r1.1 bio.info 1a2 > core = 6.x Index: bio/bio.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/bio/bio.module,v retrieving revision 1.2.2.14 diff -r1.2.2.14 bio.module 5c5 < * Implementation of hook_init() --- > * Implementation of hook_boot() 7c7 < function bio_init() { --- > function bio_boot() { 15,16c15 < /** < * Implementation of hook_menu() --- > /* hook_menu() 18,27c17,22 < function bio_menu($may_cache) { < global $user; < $items = array(); < if ($may_cache) { < $items[] = array( < 'path' => 'admin/user/bio', < 'title' => t('User biographies'), < 'description' => t('User biographies'), < 'callback' => 'drupal_get_form', < 'callback arguments' => array('bio_settings'), --- > function bio_menu() { > $items['admin/user/bio'] = array( > 'title' => 'User biographies', > 'description' => 'User biographies', > 'page callback' => 'drupal_get_form', > 'page arguments' => array('bio_settings'), 29,61c24,56 < } < else { < if (variable_get('bio_profile', 0) && (arg(0) == 'user') && (is_numeric(arg(1)))) { < $type = variable_get('bio_nodetype','bio'); < $nid = bio_for_user(arg(1)); < // user has a bio < if ($nid) { < $node = node_load($nid); < $access = node_access('update', $node); < } < else { < $node = (object) array('type' => $type, 'uid' => arg(1)); < $access = (($user->uid == arg(1)) && node_access('create', $type)) || user_access('administer nodes'); < } < $items[] = array( < 'path' => 'user/'.arg(1).'/bio', < 'title' => node_get_types('name', $type), < 'callback' => 'node_page_edit', < 'callback arguments' => array($node), < 'type' => MENU_LOCAL_TASK, < 'access' => $access, < ); < } < elseif (variable_get('bio_profile', 0) && (arg(0) == 'node') && is_numeric(arg(1)) && !arg(2)) { < // if we're about to visit a bio node page, but we've got "use bios for profiles" selected, < // redirect to the user page < $node = node_load(arg(1)); < if (user_access('access user profiles') && $node->type == variable_get('bio_nodetype','bio')) { < drupal_goto('user/'. $node->uid); < } < } < } < return $items; --- > > $type = variable_get('bio_nodetype','bio'); > $items['user/%user/bio'] = array( > 'title' => node_get_types('name', $type), > 'page callback' => 'bio_menu_page', > 'page arguments' => array(1), > 'type' => MENU_LOCAL_TASK, > 'access callback' => 'bio_menu_access_callback', > 'access arguments' => array(1), > ); > return $items; > } > > function bio_menu_access_callback($arg) { > $nid = bio_for_user($arg->uid); > if($nid) { > $node = node_load($nid); > return node_access('update',$node); > } > else { > global $user; > $type = variable_get('bio_nodetype','bio'); > $access = (($user->uid == $arg->uid) && node_access('create', $type)) || user_access('administer nodes'); > return $access; > } > } > > function bio_menu_page($arg) { > module_load_include('inc','node','node.pages'); > $type = variable_get('bio_nodetype','bio'); > $nid = bio_for_user($arg->uid); > $node = $nid ? node_load($nid) : (object) array('type' => $type, 'uid' => $arg->uid, 'name' => $arg->name); > return drupal_get_form($type.'_node_form',$node); 69,70c64,65 < function bio_form_alter($form_id, &$form) { < if ($form_id == variable_get('bio_nodetype', 'bio') ."_node_form" && arg(0) == 'user') { --- > function bio_form_alter(&$form, $form_state, $form_id) { > if ($form_id == variable_get('bio_nodetype','bio')."_node_form" && arg(0) == 'user') { 75,79c70,74 < $form['author']['name']['#default_value'] = $account->name; < $form['author']['name']['#value'] = $account->name; < $form['author']['name']['#disabled'] = 'disabled'; < unset($form['author']['name']['#autocomplete_path']); < $form['author']['name']['#description'] = t(' This field is disabled. You cannot alter the author of this entry from within the user area.'); --- > $form['author']['name']['#disabled'] = 'disabled'; > $form['author']['name']['#default_value'] = $account->name; > $form['author']['name']['#value'] = $account->name; > $form['author']['name']['#description'] = t(' This field is disabled. You cannot alter the author of this entry from within the user area.'); > unset($form['author']['name']['#autocomplete_path']); 81c76 < } --- > } 85c80 < if ($form_id == 'user_register' && variable_get('bio_regstration_form', 0)) { --- > /* if ($form_id == 'user_register' && variable_get('bio_regstration_form', 0) && module_exists('content')) { 109,111c104,106 < $form['#submit']['bio_user_reg_submit'] = array(); < $form['#validate']['bio_user_register_validate'] = array(); < } --- > $form['#submit'][] = 'bio_user_reg_submit'; > $form['#validate'][] = 'bio_user_register_validate'; > }*/ 117c112 < function bio_user_register_validate($form_id, $form_values) { --- > /*function bio_user_register_validate($form_id, $form_values) { 129c124 < } --- > }*/ 135c130 < function bio_user_reg_submit($form_id, $form_values) { --- > /*function bio_user_reg_submit($form_id, $form_values) { 158c153 < } --- > }*/ 160c155 < function bio_profile_alter(&$account, &$fields) { --- > function bio_profile_alter(&$account) { 164,168c159,163 < foreach($fields as $key => $val) { < if ($key != $typename) { < unset($fields[$key]); < } < } --- > foreach($account->content as $key => $content) { > if($key != node_get_types('name', variable_get('bio_nodetype', 'bio'))) { > unset($account->content[$key]); > } > } 183a179 > 'description' => t('A Biography is a simple node type that will replace the typical user profile view with the content of the Biography node.'), 219c215 < function bio_user($op, &$edit, &$user, $category = NULL) { --- > function bio_user($op, &$edit, &$account, $category = NULL) { 224c220 < if (!$nid = bio_for_user($user->uid)) return; --- > if (!$nid = bio_for_user($account->uid)) return; 226c222,224 < return array(node_get_types('name', variable_get('bio_nodetype', 'bio')) => array('bio' => array('value' => node_view($node, FALSE, TRUE, FALSE)))); --- > $account->content[node_get_types('name', variable_get('bio_nodetype', 'bio'))] = array( > '#value' => node_view($node, FALSE, TRUE, FALSE), > ); 303,309c301,308 < $form['bio_regstration_form'] = array( < '#type' => 'radios', < '#title' => t('Show fields on registration form'), < '#options' => array(t('Disabled'), t('Enabled')), < '#default_value' => variable_get('bio_regstration_form', 0), < '#description' => t('Enable this option to display bio fields on the user registration form. This will automatically create a bio record for a user when they register.'), < ); --- > if (module_exists('content')) { > $form['bio_regstration_form'] = array( > '#type' => 'radios', > '#title' => t('Show fields on registration form'), > '#options' => array(t('Disabled'), t('Enabled')), > '#default_value' => variable_get('bio_regstration_form', 0), > '#description' => t('Enable this option to display bio fields on the user registration form. This will automatically create a bio record for a user when they register.'), > ); 311,321c310,321 < // Determine the options and default values. < $fields = _bio_get_fields(); < $default_values = variable_get('bio_regstration_form_fields', array()); < foreach ($fields as $field_name => $properties) { < $options[$field_name] = check_plain($properties['widget']['label']); < // Required fields are always shown on registration form. < if ($properties['required'] || !empty($default_values[$field_name])) { < $default_values[$field_name] = $field_name; < } < else { < $default_vales[$field_name] = 0; --- > // Determine the options and default values. > $fields = _bio_get_fields(); > $default_values = variable_get('bio_regstration_form_fields', array()); > foreach ($fields as $field_name => $properties) { > $options[$field_name] = check_plain($properties['widget']['label']); > // Required fields are always shown on registration form. > if ($properties['required'] || !empty($default_values[$field_name])) { > $default_values[$field_name] = $field_name; > } > else { > $default_vales[$field_name] = 0; > } 322a323,331 > // Display list of fields. > $form['bio_regstration_form_fields'] = array( > '#type' => 'checkboxes', > '#title' => t('Registration form fields'), > '#options' => $options, > '#default_value' => $default_values, > '#description' => t('Fields checked here will be displayed on the user registration form. Required fields are always shown.'), > '#theme' => 'bio_registration_fields', > ); 324,332d332 < // Display list of fields. < $form['bio_regstration_form_fields'] = array( < '#type' => 'checkboxes', < '#title' => t('Registration form fields'), < '#options' => $options, < '#default_value' => $default_values, < '#description' => t('Fields checked here will be displayed on the user registration form. Required fields are always shown.'), < '#theme' => 'bio_registration_fields', < ); 335c335 < $add_a_submit['#validate']['bio_settings_validate_xxx'] = array(); --- > $add_a_submit['#validate'][] = 'bio_settings_validate_xxx'; 347c347 < foreach (element_children($form) as $field_name) { --- > foreach (element_children($form) as $field_name) { 364c364 < function bio_settings_validate_xxx($form_id, $form_values) { --- > /*function bio_settings_validate_xxx($form_id, $form_values) { 368c368 < } --- > }*/ 373c373 < function _bio_get_fields() { --- > /*function _bio_get_fields() { 377c377 < } --- > }*/ 386c386 < function bio_views_tables_alter(&$tables) { --- > /*function bio_views_tables_alter(&$tables) { 389c389 < } --- > }*/ 397c397 < function bio_handler_filter_isnew($op, $filter, $filterinfo, &$query) { --- > /*function bio_handler_filter_isnew($op, $filter, $filterinfo, &$query) { 400c400 < } --- > }/* 405c405 < function bio_views_query_alter(&$query, $view, $summary, $level) { --- > /*function bio_views_query_alter(&$query, $view, $summary, $level) { 413c413 < } --- > }*/