Skip to Content Skip to Menu

CB Ajax File Field Plugin - Renaming Folders

  • beyondlaw
  • beyondlaw
  • OFFLINE
  • Posts: 4
  • Thanks: 1
  • Karma: 0
10 years 3 months ago #246631 by beyondlaw
Hi there,

I have installed the CB Ajax File Field plugin successfully and tested a file upload.

As expected, it uploads to plug_cbfilefield/USERIDNUMBER. Instead of creating folder names with USERIDNUMBER, is it possible to rename with the registered username or userfirstnameuserlastname?

Thanks!

Please Log in or Create an account to join the conversation.

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
10 years 3 months ago #246632 by nant

beyondlaw wrote: Hi there,

I have installed the CB Ajax File Field plugin successfully and tested a file upload.

As expected, it uploads to plug_cbfilefield/USERIDNUMBER. Instead of creating folder names with USERIDNUMBER, is it possible to rename with the registered username or userfirstnameuserlastname?

Thanks!


No such feature exists and in theory the username or name fields can be changed, but the userid never changes.

Please Log in or Create an account to join the conversation.

  • w8ing4u
  • w8ing4u
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 0
10 years 1 week ago - 10 years 1 week ago #250352 by w8ing4u
Replied by w8ing4u on topic CB Ajax File Field Plugin - Renaming Folders
I've managed to have CB file field create folders with both USER ID and Name, so it's still unique and it hasn't caused trouble so far. The final result is:

"ID_Firstname Lastname".

But make sure you have some rule in the form where your users have to enter their first and last name. If you allow special characters, you may have problems with the directory name... In that case, you may opt for "USERID_USERNAME"

What I did was just searching the php file for any string containing the path to the folder (images/comprofiler/plug_cbfilefield) and add '_' . $user->name . to the previous $user->id

I'd like to do the same with the file names in order to have:
"cb_field name" (not the names the user decides to give his file) underscore "full name" , but it doesn't seem to be working as the system truncates spaces in the name
Last edit: 10 years 1 week ago by w8ing4u.

Please Log in or Create an account to join the conversation.

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
10 years 1 week ago #250370 by nant

w8ing4u wrote: I've managed to have CB file field create folders with both USER ID and Name, so it's still unique and it hasn't caused trouble so far. The final result is:

"ID_Firstname Lastname".

But make sure you have some rule in the form where your users have to enter their first and last name. If you allow special characters, you may have problems with the directory name... In that case, you may opt for "USERID_USERNAME"

What I did was just searching the php file for any string containing the path to the folder (images/comprofiler/plug_cbfilefield) and add '_' . $user->name . to the previous $user->id

I'd like to do the same with the file names in order to have:
"cb_field name" (not the names the user decides to give his file) underscore "full name" , but it doesn't seem to be working as the system truncates spaces in the name


Why would you want this? I guess just for folder inspection purposes.

But if your users change their last or first name of username you will break access to the files.

Please Log in or Create an account to join the conversation.

  • w8ing4u
  • w8ing4u
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 0
10 years 1 week ago #250410 by w8ing4u
Replied by w8ing4u on topic CB Ajax File Field Plugin - Renaming Folders


Why would you want this? I guess just for folder inspection purposes.

But if your users change their last or first name of username you will break access to the files.


We're using CB for students application to a course. As we receive hundreds of applications, it's definitely better for us to have folders and files with users' names instead of just their ID.

Of course I've made both first and last name fields readonly :)

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum