ZenphotoCMS Forum
Updating FolderName (Rename) automatically - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: Plugins (https://forum.zenphoto.org/forum-6.html)
+--- Thread: Updating FolderName (Rename) automatically (/thread-12511.html)



Updating FolderName (Rename) automatically - thommy - 09-05-2016

Hi,

I'm using custom fields for an album added by my plugin.
Is it possible to rename the album-directory dynamically by saving an album (edit album)?

new directory name = custom_field1;
What filter to use for that?
zp_register_filter('new_album', 'updateAlbum'); ???

Can anybody give me an example how to handle this?




Updating FolderName (Rename) automatically - sbillard - 10-05-2016

The album object has a rename(to) method that does this. Please note that dynamic albums will hide the suffix in the User interface, but you definitely would need to include it when calling that method.

Also note that renaming and moving are different functions. Renaming presumes that the parent album does not change.




Updating FolderName (Rename) automatically - thommy - 10-05-2016

Thank you!
To influence the saving-process - how to do it? Is there a filter to use?




Updating FolderName (Rename) automatically - acrylian - 10-05-2016

You find info about filters here: http://www.zenphoto.org/news/zenphoto-plugin-architecture/