plainblack.com
Username Password
search
Bookmark and Share
View All Tickets
User profile images disappear after updat  (#3170)
Issue

When adding a picture to a userprofile this picture disappears after updating another field of the profiledata.

the column fielddata in table userprofiledata is set to NULL after update.

Thank you,

Solution Summary
Comments
perlDreamer
0
5/31/2007 12:17 pm
Is the editing of the profile done by the user or by an Admin?
webrene
0
5/31/2007 12:45 pm
The editing is done by the admin but it must be possible to do so for the user

in both ways the picture is gone after editing the profile

we did checked the database to see what happens, after updating the field for the picture is set to NULL



On May 31, 2007, at 7:17 PM, <ckuskie@sterlink.net> wrote:


Rene Enge
=====================
=====================




webrene
0
6/20/2007 8:55 am

We tackled this problem by editting the webgui source.

Everything is now working fine

perlDreamer
0
6/20/2007 10:38 am
If you've fixed the bug, do you mind posting the patch so that we can add it to the core?
webrene
0
6/21/2007 5:28 am

Hello, this is what we did to the following files. This works for us we hope you can add this to the core.

We updated the file User.pm, this file is located in /data/WebGUI/lib/WebGUI

wrintings in bold are new to the file

sub profileField {        my ($self, $fieldName, $value);        $self = shift;        $fieldName = shift;        $value = shift;        if (!exists $self->{_profile}{$fieldName} && !$self->session->db->quickScalar("SELECT COUNT(*) FROM userProfileField WHERE fieldName = ?", [$fieldName]) ) {                $self->session->errorHandler->warn("No such profile field: $fieldName");                return undef;        }        if (defined $value) {                $self->uncache;                $self->{_profile}{$fieldName} = $value;                 my $photo = $self->session->db->read("select fieldData from userProfileData where userId=? and fieldName=?",[$self->{_userId}, 'photo']);                 $self->session->db->write("delete from userProfileData where userId=? and fieldName=?",[$self->{_userId}, $fieldName]);                $self->session->db->write("insert into userProfileData values (?,?,?)", [$self->{_userId}, $fieldName,$value]);                 my $foto = $photo->array;                if ($fieldName eq 'photo' and $value eq ' ' )                {                  if ($foto ne ' ' )                  {                  $self->session->db->write("update userProfileData set fieldData=?  where userId=? and fieldName=?",[$foto, $self->{_userId}, 'photo']);                  }                }                my $time = $self->session->datetime->time();                $self->{_user}{"lastUpdated"} = $time;                $self->session->db->write("update users set lastUpdated=? where userId=?", [$time, $self->{_userId}]);        }        return $self->{_profile}{$fieldName};

}

=====================================================================================

We also updated the file /data/WebGUI/lib/WebGUI/Form/Image.pm

wrintings in bold are new to the file

sub displayForm {        my ($self) = @_;        return $self->toHtml;        #unless $self->get('value');         ##There are files inside here, for each one, display the image        ##and another form control for deleting it.        my $location = WebGUI::Storage::Image->get($self->session, $self->get('value'));        my $i18n = WebGUI::International->new($self->session);        my $fileForm = '';        my $file = shift @{ $location->getFiles };         $fileForm .= sprintf qq!<img src="%s" / width=100><br />!, $location->getUrl($file);        #$fileForm .= sprintf qq!<img src="%s" /><br />!, $location->getUrl($file);        #$fileForm .= $i18n->get(392)        #         .  "&nbsp"x4        #         . WebGUI::Form::YesNo->new($self->session, {-name=>$self->privateName('delete'), -value=>0})->toHtml;        $fileForm .= $self->toHtmlAsHidden();        $fileForm .= WebGUI::Form::Hidden->new($self->session, {-name => $self->privateName('action'), -value => 'keep'})->toHtml();        return $fileForm;}
==========================================================================================Thank you,
Graham
0
6/27/2007 8:09 am
Partial fix checked in.  Editing the images works properly, but displays incorrectly the page displayed after editing using the admin
Graham
0
7/20/2007 5:48 pm
This is fixed now for 7.4
Details
Ticket Status Closed  
Rating0.0 
Submitted Byrene 
Date Submitted2007-05-31 
Assigned To unassigned  
Date Assigned2010-09-02 
Assigned By 
Severity Critical (mostly not working)  
What's the bug in?  
WebGUI / WRE Version 7.3.18  
URLbugs/tracker/user-profile-images-disappear-after-updat
Keywords
Ticket History
© 2010 Plain Black Corporation | All Rights Reserved