From 640149d1cb9d9cc1571510cd45dbffd02392e666 Mon Sep 17 00:00:00 2001 From: Tim Steiner <tsteiner2@unl.edu> Date: Fri, 2 Jul 2010 22:05:40 +0000 Subject: [PATCH] When using the CAS module, grab user images from planetred and disable the change password and change image fields on the user profile page. git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@132 20a16fea-79d4-4915-8869-1ea9d5ebf173 --- sites/all/modules/unl/unl_cas.module | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sites/all/modules/unl/unl_cas.module b/sites/all/modules/unl/unl_cas.module index e9969efa..62cc8ea6 100644 --- a/sites/all/modules/unl/unl_cas.module +++ b/sites/all/modules/unl/unl_cas.module @@ -86,9 +86,19 @@ function unl_cas_form_alter(&$form, $form_state, $form_id) if ($form_id == 'user_login') { $_SESSION['unl_cas']['previous_path'] = request_path(); $cas = unl_cas_get_adapter(); - //$cas->setRenew(); drupal_goto($cas->getLoginUrl()); } + + if ($form_id == 'user_profile_form') { + $form['account']['pass']['#type'] = 'hidden'; + $form['account']['current_pass_required_values']['#type'] = 'hidden'; + $form['account']['current_pass']['#type'] = 'hidden'; + + $form['picture']['#description'] = 'To change your picture, visit <a href="http://planetred.unl.edu">planetred</a>.'; + $form['picture']['picture_delete']['#type'] = 'hidden'; + $form['picture']['picture_upload']['#type'] = 'hidden'; + } + } function unl_cas_user_logout($account) @@ -121,3 +131,10 @@ function unl_cas_import_user($username) return $user; } +function unl_cas_preprocess_user_picture(&$variables) +{ + //Default image: http://planetred.unl.edu/mod/profile/graphics/defaulttopbar.gif + $username = $variables['account']->name; + $variables['user_picture'] = '<img src="http://planetred.unl.edu/pg/icon/unl_' . $username . '/large" alt="alt" />'; +} + -- GitLab