summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-07-12 08:36:35 +0000
committerDries Buytaert <dries@buytaert.net>2009-07-12 08:36:35 +0000
commit6dc5b5449d6c52b433e6b712786c2e49778a363f (patch)
tree66e4926fa3dcc0a33f46f4145ca5b72bf7458943 /modules/user/user.module
parent065fa60551edddc27a30d04cecb58b30b7ac8e3c (diff)
downloadbrdo-6dc5b5449d6c52b433e6b712786c2e49778a363f.tar.gz
brdo-6dc5b5449d6c52b433e6b712786c2e49778a363f.tar.bz2
- Patch #491456 by quicksketch, drewish, et al: image effects and actions.
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module26
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() {