Project

General

Profile

Feature #7072

Add "file upload" type in profile fields

Added by Yannick Warnier almost 6 years ago. Updated almost 6 years ago.

Status:
Feature implemented
Priority:
Normal
Category:
Users/Groups
Target version:
Start date:
09/04/2014
Due date:
24/04/2014
% Done:

100%

Estimated time:
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

In order to flexibilize Chamilo a little more, we should have a "File upload" option as one of the user profile fields possibilities in main/admin/user_fields_add.php?action=fill

This field (only allowing for one file) would then be possible to show in one's profile and, ideally, in the registration form, so a user can upload his CV or something like that.

This would later make it possible to remove completely the "extended profile" options, by building the migration script in such a way that it would transfer those fields from the "user" table to the user_field_values table (opening a task for 1.10 for that: #7068)

Associated revisions

Revision 450e13b4 (diff)
Added by Yannick Warnier almost 6 years ago

Implement partial "file upload" field - refs #7072

Revision 7447127e (diff)
Added by Yannick Warnier almost 6 years ago

Implement partial "file upload" field (2) - refs #7072

Revision d748c17d (diff)
Added by Daniel Barreto almost 6 years ago

Add functions to upload user extra field type file and update code after submit form values in user_edit.php and auth/profile.php -refs #7072

Revision 3bacc902 (diff)
Added by Daniel Barreto almost 6 years ago

Add Security::filter_name() and update functions to find files from user_field_values table -refs #7072

Revision 484f98b8 (diff)
Added by Daniel Barreto almost 6 years ago

Update $extras array keys doesn't contain 'extra_' then substr($key , 6) is useless -refs #7072

Revision 07f6db55 (diff)
Added by Daniel Barreto Alva almost 6 years ago

Fix issue with file type extra field in user registration process - refs #7072

History

#1

Updated by Yannick Warnier almost 6 years ago

I already sent 2 commits to guide you. There is still some code to be added for the upload of the file. You should check the update_user_picture() or the functions used for the "extended profile" (one of them is exactly what we need, but it might be a bit "old")

#2

Updated by Daniel Barreto almost 6 years ago

  • Assignee changed from Francis Gonzales to Daniel Barreto
#3

Updated by Daniel Barreto almost 6 years ago

  • % Done changed from 0 to 70

It's done, but I need to complete when delete a file (Now delete it from folder but not from user_field_value table)

#4

Updated by Daniel Barreto almost 6 years ago

  • Status changed from Assigned to Needs testing
  • Assignee deleted (Daniel Barreto)
  • % Done changed from 70 to 80

Complete, by the moment just can upload 1 file by file type user extra field

Done in PR #266
https://github.com/chamilo/chamilo-lms/pull/266

#5

Updated by Yannick Warnier almost 6 years ago

Commit is incomplete - see comment on github PR

#6

Updated by Yannick Warnier almost 6 years ago

  • Status changed from Needs testing to Assigned
  • Assignee set to Daniel Barreto
  • % Done changed from 80 to 60
#7

Updated by Yannick Warnier almost 6 years ago

  • Due date set to 24/04/2014
#8

Updated by Daniel Barreto almost 6 years ago

  • Status changed from Assigned to Needs testing
  • Assignee changed from Daniel Barreto to Yannick Warnier
  • % Done changed from 60 to 80
Updates:
  • Add Security:filter_name()
  • The file will be stored into user's folder/field/filename
  • The route of the file stored in user_field_value will be relative to user folder
  • To get already uploaded file will search into user_field_values

Update PR#266

https://github.com/chamilo/chamilo-lms/pull/266

#9

Updated by Yannick Warnier almost 6 years ago

  • Status changed from Needs testing to Assigned
  • Assignee changed from Yannick Warnier to Daniel Barreto
  • % Done changed from 80 to 60

Daniel, I merged your PR but uploading a file doesn't work anymore. The field appears, I can select a file, I click save and I have the approval message, but no file is uploaded: the main/upload/users/1/1/ folder is empty. The database (user_field_values) is also empty.

#10

Updated by Daniel Barreto almost 6 years ago

  • % Done changed from 60 to 80

Update:
In auth/profile.php $extras array is already substr($key,6) from original key (LINE: 553)
Then doesn't contain prefix 'extra_', this is removed with substr()
Fix code from previos PR where was calling substr($key, 6) to just $key.

Done in PR#283
https://github.com/chamilo/chamilo-lms/pull/283

#11

Updated by Yannick Warnier almost 6 years ago

  • Status changed from Assigned to Feature implemented
  • % Done changed from 80 to 100

Tested and approved! Thanks.

#12

Updated by Daniel Barreto almost 6 years ago

  • Assignee deleted (Daniel Barreto)
  • % Done changed from 100 to 80

Update to work in register user form (main/auth/inscription.php)
Needs Testing.

Done in PR#293
https://github.com/chamilo/chamilo-lms/pull/293

#13

Updated by Daniel Barreto almost 6 years ago

  • Status changed from Feature implemented to Needs testing
#14

Updated by Yoselyn Castillo almost 6 years ago

  • Assignee set to Yoselyn Castillo
#15

Updated by Yannick Warnier almost 6 years ago

  • Assignee changed from Yoselyn Castillo to Yannick Warnier

Yoselyn, leave this to me. I know exactly what to test and how to test it.

#16

Updated by Yannick Warnier almost 6 years ago

  • Status changed from Needs testing to Feature implemented
  • Assignee changed from Yannick Warnier to Daniel Barreto
  • % Done changed from 80 to 100

OK. When there is something wrong in the form, the error returns on the page and all other fields keep the data, but the file upload is not kept. This is a very minor issue and it can be fixed later on. I'm closing this task. Well done.

#17

Updated by Yannick Warnier almost 6 years ago

Actually, it is logical that the file upload would not be kept as it needs the user directory in order to upload it, and the directory itself does not exist because the user could not be created... logical!

Also available in: Atom PDF