dkoukoul
Forum Replies Created
-
Hello again @champsupertramp I am still trying to debug this. I have double-triple checked the db and the code, everything looks ok, I dived into the UM code to check if there was a check somewhere that would make the file not show and I am wondering if I am missing a um function call after the uploading. Currently your code is in a php file that is being loaded as a template in a page file where the parameters are passed (filename, userid etc). Should I be calling any hooks or additional functions after um_import_files?
Thanks again for your timeI am not able to view the file with the UM profile form. The file is not shown in the profile. Thanks for your time I will look further into it.
Hi again, I just noticed that I may have described what I have noticed wrongly.
In a user where I download the file manually
I see the file uploaded on the uploads/ultimate-member/<user-id>/ as
file_93be7a94_00592ecbfcfffe0339b60344240a3b9223af4361.pdf (notice the characters between the two “_”)
In the usermeta table for this user I see the following entries
meta_key exam_report_pdf with meta_value file_93be7a94_00592ecbfcfffe0339b60344240a3b9223af4361.pdf (the file as it exists on the folder)
and meta_key exam_report_pdf_metadata with meta_value
a:7:{s:4:”name”;s:109:”<domain>/wp-content/uploads/ultimatemember/temp/file_00592ecbfcfffe0339b60344240a3b9223af4361.pdf”;s:13:”original_name”;s:47:”<filename>.pdf”;s:8:”basename”;s:49:”file_00592ecbfcfffe0339b60344240a3b9223af4361.pdf”;s:3:”ext”;s:3:”pdf”;s:4:”type”;s:15:”application/pdf”;s:4:”size”;i:2130374;s:11:”size_format”;s:4:”2 MB”;}Notice how the basename is different (the characters between the two “_” are not there) while the name has ultimatemember/temp/.
Any hints to why?
Thanks again for your time and helpHello @champsupertramp thank again for your time and help. Unfortunately this does not seem to resolve the issue as the wp_basename returns the filename as it is stored in the server without the extra characters that seem to be the case when I upload the file manually. I was looking into the UM code for file uploading but unfortunately haven’t detected yet how this filename gets generated. I will keep on trying and if I find something else I’ll keep this post updated.
Hello @champsupertramp I had the time to test this unfortunately it is not working as intended.
The file is renamed and the entries in the database are there but the file is not shown on the um profile of the user. I did some file uploads manually from the um form to check for differences in the database entries and I noticed the following:
When I do a manual file upload the meta_key of exam_report_pdf takes a value of a file name which has a longer filename than the file that exists in the actual folder and also is defined as “original_name” in the metadata.
for example:
In a manual upload that works I see:
exam_report_pdf = file_685b8555_b041e7a4a06a730fe61929e01b3063fd6655d4ef.pdf
and this as basename “file_b041e7a4a06a730fe61929e01b3063fd6655d4ef.pdf” and the filename that exists in the uploads folder.
While in our case the filename in the folder is the same as the basename and the entry in the exam_report_pdf.
I do not know if this “_685b8555” which seems to be added comes from UM or from a wordpress function. But I guess this is what we are missing to make it work. You have been of great help already and thanks for your time!Thanks for the detailed answer @champsupertramp I’ll try it and get back to you!
Hi @champsupertramp thanks for the reply. I have done that. The plug in works ok. I just need help in restoring the extra functionality that I had working where I was able to upload files via FTP directly to a user’s folder ../wp-content/uploads/ultimate-member/userid/filename.pdf and then make them appear on their um profile by inserting the metadata to the database at the usermeta table using the meta_key “exam_report_pdf” and “exam_report_pdf_metadata”. Is there a um function available in the api to do this as my previous method does not seem to work anymore as I see that the plugin is working by renaming the files and then retrieving the download link using the nonce functionality… Thanks for your time.
Last version was 2.0.43. I noticed also that when I updated the UM plug in I updated WordPress and PHP version into 7.3, I am not sure if this has any relevance though. Regards
Can someone help me with this? I want to find a way to upload files to users directly by FTP and then inserting the relevant information to the DB
ThanksLooking deeper into this I discovered that it started happening after I changed a hook that I was using in my plugin.
When I use the “um_before_update_profile” hook the fields (first_name, last_name, birth_date) are showing on the profile empty. When I use the “um_user_after_updating_profile” hook then the fields show correctly on the profile form after registration.
My problem is that with the “um_user_after_updating_profile” I do not have access to the $user_id of the account edited which is what I can get from “um_before_update_profile”.
But my understanding was that the “um_before_update_profile” hook was called once the “update” button was clicked.
Can you please advice any possible solution? Either on how to get the user_id of the profile edited in the “um_user_after_updating_profile” (not the current user logged in, but the profile edited user id, I have checked the um_profile_id and it returns the current user id) or a way to show correctly the fields in the profile form even when using the “um_before_update_profile” hook?
thank you very muchHello,
I am having the same issue. I have the following fields in my registration form:
-username
-email
-date of birth
-first name
-last nameThey are filled and I can see the values passed in the database in the usermet table on the submitted field. When user logs in and goes to their profile where I have the same fields they are all empty except username and email. Any ideas why the rest do not show? If I edit them in the profile then they are shown but they are not after the registration.
Any help would be appreciated.