Using this module the text "Minimum height is ." will appear on your users profile edit page if you don't have any user picture minimum dimensions set.
The problem is in this code from the imagecache_profiles_form_user_profile_form_alter() function:
if (!empty($width)) {
if (!empty($height)) {
$description = t('Minimum dimensions are %dimensions.', array('%dimensions' => $width . 'x' . $height));
}
else {
$description = t('Minimum width is %width.', array('%width' => $width));
}
}
else {
$description = t('Minimum height is %height.', array('%height' => $height));
}
In plain English, the code is doing this:
- If neither height nor width is empty, print the dimensions
- If height is empty but width isn't, print the width
- If width is empty, print the height
I think the easiest solution to this problem is to add a condition immediately following the code above:
if (empty($width) && empty($height)) $description = '';
I've added that code to my own copy of the module and it works as intended.
- Ryan
Comment | File | Size | Author |
---|---|---|---|
#5 | imagecache_profiles-min-height-always-shown-918520-5.patch | 1.49 KB | wjaspers |
#1 | fixcondition.patch | 470 bytes | rschwab |
Comments
Comment #1
rschwab CreditAttribution: rschwab commented1st attempt at patch
Comment #2
rschwab CreditAttribution: rschwab commentedWorks for me. Does it work for you?
Comment #3
mmachina CreditAttribution: mmachina commentedoh yeah! works like a charm!!!
Comment #4
wjaspers CreditAttribution: wjaspers commentedOther modules that alter the form field description may lose their value.The formatting doesn't match Drupal's standards, but looks ok otherwise.
Therefore, I'm setting this to Needs Work.
I have a patch, and will upload promptly today.
Comment #5
wjaspers CreditAttribution: wjaspers commentedHere's another patch that follows Drupal's coding conventions and checks things based on completed fields.