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

andypost’s picture

Status: Patch (to be ported) » Needs work

I'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

andypost’s picture

Another review marked as duplicate #585704: Full size images showing on profile pages

andypost’s picture

andypost’s picture

Title: Patch for correct behavior with Privatemsg, User Relationships, Me & other modules » Patch for correct behavior with Me module

Mostly this commited but not for me module, any reviews and new patch are welcome.
Changing title

andypost’s picture

Status: Needs work » Needs review
StatusFileSize
new1004 bytes

Here is a patch but it needs review!

sadist’s picture

just 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.

sadist’s picture

hi andy, any progress on this patch? thanks.

andypost’s picture

As I said I'm not using this module so I cant test this... so waiting for reviewers

sadist’s picture

Hi andy, sorry for not looking at it thoroughly earlier. Actually you'd just missed out a ')' bracket in your patch.

if (arg(0) == 'user' && (is_numeric(arg(1)) || (module_exists('me') && arg(1) == me_variable_get('me_alias')) && (arg(2) == NULL || arg(2) ==
'edit'))) {

and it will work. Thanks.

andypost’s picture

@sadist Could you re-roll working patch?

sadist’s picture

StatusFileSize
new699 bytes

This is my first time creating a patch and I'm still learning. Hope it helps. ;)

andypost’s picture

Status: Needs review » Fixed
StatusFileSize
new1.39 KB

Commited original patch because it's more clear

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.