From 6dc5b5449d6c52b433e6b712786c2e49778a363f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 12 Jul 2009 08:36:35 +0000 Subject: - Patch #491456 by quicksketch, drewish, et al: image effects and actions. --- modules/user/user.module | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'modules/user/user.module') 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); @@ -2652,6 +2657,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(). */ -- cgit v1.2.3