I ran into a problem today when playing around with the different options that are available for the image javascript crop module when disabling the core profile picture functionality and replacing it with a custom imagefield field.

Scenario:
1) User has uploaded a picture using the default profile picture upload form.
2) Disable profile picture from Account Settings
3) Create an image field (field_picture) on the Manage Fields tab of Account Settings and set as the imagecrop style
4) Try to upload a photo in the new picture field that was created.

It looks like this is happening because the form sets the picture element even though it is not being displayed. $hooks is being set to 'profile_picture' => 0, 'media' => 0 and in_array('profile_picture', $hooks) is only checking to see that the value exists in the array, not that it is set to 1. At first glance, this could be fixed by replacing
if (!empty($form['picture']['picture']['#value']) && in_array('profile_picture', $hooks) ) {
with
if (!empty($form['picture']['picture']['#value']) && $hooks['profile_picture'] == 'profile_picture' ) {

Thanks,
John Doyle

Comments

nils.destoop’s picture

Status: Active » Fixed

Thanx for reporting this issue. A fix has been committed to dev.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Modified the proposed line of code because the value of $hooks['profile_picture'] holds 'profile_picture', not 1.