CCK 6.x-2.2
imagefield 6.x-3.0-alpha4
I've got nodes using a CCK ImageField. UserA creates a node, and I, the admin, would like to add an image to that node. The current path is set to be "project_pics/[user]". You would think this would insert the node's author's name, but it doesn't. Instead, it inserts the admin's username. This is a problem.
For example, when I, Admin, add images to UserA's nodes, the path to those images gets set to "project_pics/admin/filename.jpg" instead of "project_pics/UserA/filename.jpg"
1) How do I add the node's author's name to the path.
2) How do I go back and change ImageField images to link to the node's author's folder instead of the admin (i.e. how do I change the path to images)? I added a ton of images before I discovered this problem :(
Thanks.
Comments
Comment #1
quicksketchUse the FileField Paths module to gain access to the node-level tokens, then use the [author-name] token instead. The [user] token always means the currently logged in user. You'll need to upgrade to the latest version of ImageField and FileField.
I'd recommend a PHP script of some sort. Use the file_move() function to move the files and db_query() to update the paths.
Comment #2
quicksketchComment #3
gallamine commentedThanks! Any tips on what db_query() I should be running to update the paths?
Comment #4
quicksketchProbably something like this (not tested at all).
Comment #5
quicksketch