Download & Extend

Patch for correct behavior with Me module

Project:ImageCache Profiles
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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
AttachmentSize
imagecache_profiles.module.patch1.24 KB

Comments

#1

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

#2

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

#3

#4

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

#5

Status:needs work» needs review

Here is a patch but it needs review!

AttachmentSize
493734_me_integration.patch 1004 bytes

#6

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.

#7

hi andy, any progress on this patch? thanks.

#8

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

#9

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.

#10

@sadist Could you re-roll working patch?

#11

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

AttachmentSize
imagecache_me.patch 699 bytes

#12

Status:needs review» fixed

Commited original patch because it's more clear

AttachmentSize
493734_me_integration.patch 1.39 KB

#13

Status:fixed» closed (fixed)

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

nobody click here