Many modules add off the user/123 path. E.g. user/1/relationships for User Relationships. Imagecache Profiles incorrectly decides that these pages are profile pages, and so the profile preset should be shown. That's not desired since the pictures of other users may be shown in a list. The use of the profile imagecache preset should be very limited to the profile page, and the account edit page.
Also, if you have the Me module installed user/me is the profile page, but Imagecache Profiles sees 'me' is not an integer, and decides that is not a profile page, even though it is.
This patch fixes both of these problems.
Index: imagecache_profiles.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache_profiles/imagecache_profiles.module,v
retrieving revision 1.5
diff -u -r1.5 imagecache_profiles.module
--- imagecache_profiles.module 19 Dec 2008 18:12:56 -0000 1.5
+++ imagecache_profiles.module 17 Jun 2009 02:27:00 -0000
@@ -32,9 +32,15 @@
$size = variable_get('user_picture_imagecache_profiles_default', 0);
}
// If on user profile page
- if (arg(0) == 'user' && is_numeric(arg(1))) {
- if (variable_get('user_picture_imagecache_profiles', 0)) {
- $size = variable_get('user_picture_imagecache_profiles', 0);
+ if (arg(0) == 'user') {
+ // only show profile image for profile page, and edit account form, not user/123/relationships or
+ // other module define pages
+ if (arg(2) == NULL || arg(2) == 'edit') {
+ if (is_numeric(arg(1)) || (module_exists('me') && arg(1)==me_variable_get('me_alias')) ) {
+ if (variable_get('user_picture_imagecache_profiles', 0)) {
+ $size = variable_get('user_picture_imagecache_profiles', 0);
+ }
+ }
}
}
// If viewing a comment
Comments
Comment #1
andypostI'm not using me module so I need more reviews on it.
Commited http://drupal.org/cvs?commit=265338 to use only on /user/N and /user/N/edit pages
Comment #2
andypostAnother review marked as duplicate #585704: Full size images showing on profile pages
Comment #3
andypostAnother issue with panels #586546: Error when viewing User Profile - [function.array-key-exists
Comment #4
andypostMostly this commited but not for me module, any reviews and new patch are welcome.
Changing title
Comment #5
andypostHere is a patch but it needs review!
Comment #6
sadist commentedjust a quick feedback. i received error message right after patching:
Parse error: syntax error, unexpected '{' in /home/drupal/sites/all/modules/imagecache_profiles/imagecache_profiles.module on line 35
i haven't look at the file yet.
Comment #7
sadist commentedhi andy, any progress on this patch? thanks.
Comment #8
andypostAs I said I'm not using this module so I cant test this... so waiting for reviewers
Comment #9
sadist commentedHi andy, sorry for not looking at it thoroughly earlier. Actually you'd just missed out a ')' bracket in your patch.
and it will work. Thanks.
Comment #10
andypost@sadist Could you re-roll working patch?
Comment #11
sadist commentedThis is my first time creating a patch and I'm still learning. Hope it helps. ;)
Comment #12
andypostCommited original patch because it's more clear