diff options
Diffstat (limited to 'modules/user/user.module')
-rw-r--r-- | modules/user/user.module | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/modules/user/user.module b/modules/user/user.module index 3072ae2ef..ac7f6cbff 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1176,7 +1176,12 @@ function template_preprocess_user_picture(&$variables) { } if (isset($filepath)) { $alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous')))); - $variables['picture'] = theme('image', $filepath, $alt, $alt, '', FALSE); + if (module_exists('image') && $style = variable_get('user_picture_style', '')) { + $variables['picture'] = theme('image_style', $style, $filepath, $alt, $alt, NULL, FALSE); + } + else { + $variables['picture'] = theme('image', $filepath, $alt, $alt, NULL, FALSE); + } if (!empty($account->uid) && user_access('access user profiles')) { $attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE); $variables['picture'] = l($variables['picture'], "user/$account->uid", $attributes); @@ -2653,6 +2658,25 @@ function user_node_load($nodes, $types) { } /** + * Implement hook_image_style_delete(). + */ +function user_image_style_delete($style) { + // If a style is deleted, update the variables. + // Administrators choose a replacement style when deleting. + user_image_style_save($style); +} + +/** + * Implement hook_image_style_save(). + */ +function user_image_style_save($style) { + // If a style is renamed, update the variables that use it. + if (isset($style['old_name']) && $style['old_name'] == variable_get('user_picture_style', '')) { + variable_set('user_picture_style', $style['name']); + } +} + +/** * Implement hook_hook_info(). */ function user_hook_info() { |