By Jordan Weinstein on Thursday, 29 May 2014
Posted in Technical Issues
Replies 9
Likes 0
Views 857
Votes 0
Hello,

Using ES 1.2.14 on Joomla 3.3.

I have enabled a file upload custom field in custom profiles to allow users to upload a file upon registration (to verify identity).

I have 3 issues:

1. Upon completion of registration, a fatal error occurs:

Catchable fatal error: Object of class stdClass could not be converted to string in /home/DOMAIN/public_html/administrator/components/com_easysocial/tables/field.php on line 1107

This also occurred on editing and saving the file for a logged-in user's edit profile screen. Removing the file upload field solves the error, however, I would like to implement this.

2. A logged in user will get these errors if the file upload field is set as a required field, 1 fatal if the file field above is enabled:

Warning: Missing argument 2 for SocialFieldsUserFile::onFieldCheck() in /home/uhema/public_html/media/com_easysocial/apps/fields/user/file/file.php on line 429

Fatal error: Cannot use object of type SocialUser as array in /home/uhema/public_html/media/com_easysocial/apps/fields/user/file/file.php on line 185

3. Where will these files be uploaded?

If there is a fix provided, please do provide me a patch to repair other sites.

Site details enclosed.

Jordan
Hi,

The files are uploaded at /media/com_easysocial/files/fields

Here is the file to patch at: /media/com_easysocial/apps/fields/user/file/file.php and this will fix both issue 1 and 2.
·
Thursday, 29 May 2014 11:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks so much Jason.

That seems to have solved the error on profile edit. but created two new issues.

1. In the upload folder, the file name is changed to a string of characters without a file extension. It makes it difficult to open these files without guessing the extension and adding it.

2. More importantly, after one successful upload for a logged-in user, I received this strange error when attempting a different file (i.e. editing the file upload):

0
Null primary key not allowed.

3. The error still persists on registration:

Catchable fatal error: Object of class stdClass could not be converted to string in /home/uhema/public_html/administrator/components/com_easysocial/tables/field.php on line 1107

Jordan
·
Thursday, 29 May 2014 12:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Sorry about that. I forgot to patch the registration section.

Here is the updated file to patch (I've also patched it through your FTP server as well).

Regarding point 2, I can't seem to reproduce this issue on your site nor locally. Here are the steps that I took:

1. Upload a file
2. Click on save
3. After saving, click on "X" to delete the file, and then upload a new file
4. Click on save

As for point 1, it is mainly because we are storing the MD5 hashes of the file with the intention of avoiding duplicated filenames. We will see if we can change this behaviour in the upcoming 1.3 since photo upload now uses the original file name.
·
Thursday, 29 May 2014 15:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jason,

Thanks.

Regarding issue #2, it does seem to work for your test account. I think what happened is, in my testing of this, for some other users I deleted the uploaded files manually from:

/media/com_easysocial/files/fields

Then when I tried re-uploading some files via profile > edit, the error #2 above occurred. So perhaps I corrupted something by deleting the files manually?

Jordan
·
Thursday, 29 May 2014 20:56
·
0 Likes
·
0 Votes
·
0 Comments
·
I can now show you how to reproduce this.

In order to clear the current uploads for all users and start over again, I deleted the contents of:

/media/com_easysocial/files/fields

As well, I deleted the contents of the database table:

_social_files

Now if you log in with the test user above and try to upload a file in Edit Profile > Confirmation > File Upload you will see the error:

0
Null primary key not allowed.

As I wonder if I may have corrupted the database, I included my cPanel login for you below. Perhaps there is another db entry that needs to be deleted as well. In fact, it seems that in addition to this custom file field upload, I can't upload avatars as well for this user.

Jordan
·
Friday, 30 May 2014 01:02
·
0 Likes
·
0 Votes
·
0 Comments
·
I think I solved it.

Not only did I delete all files, and contents of _social_files but also deleted the corresponding entry from:

_social_fields_data

Thanks.

Jordan
·
Friday, 30 May 2014 02:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Sorry for the late reply.

Yeah it is possible that there are some corrupted data going on and I am glad that it is ok now.
·
Friday, 30 May 2014 10:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jason,

Will the file.php change become part of the EasySocial core?

Also, are all the changes you made for me (fixing the profile saving and the registration error) fixed in the same file.php file?

Jordan
·
Friday, 30 May 2014 11:12
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Yes and yes definitely.
·
Friday, 30 May 2014 12:19
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post