Patch for correct behavior with Me module

mtsanford - June 17, 2009 - 02:45
Project:ImageCache Profiles
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

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

#1

andypost - September 20, 2009 - 22:32
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

andypost - September 23, 2009 - 19:40

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

#3

andypost - September 25, 2009 - 10:44

#4

andypost - October 28, 2009 - 07:55
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

 
 

Drupal is a registered trademark of Dries Buytaert.