Hello,
I am currently involved in a new project where Zenphoto would become the base for equipment selection. Apart from photos, there would be information on price, technical modifications, training, etc. I'm thinking of using the "Custom Data" and CodeBlock 1, 2, 3..." fields for that, but I need to remember what information needs to go where. Hence my question.
Is it possible to customize the name of those fields, and what would be the best way to do so? My approach would be to design a "theme page" so the relevant Edit pages are loaded with the proper description.
So do I add a theme page for the page:
zenphoto/zp-core/admin-edit.php?page=edit&album=xxx
And how do I link it?
Is it the suggested approach or is there a better approach? I do not want to change the overall look and feel of the administrative interface.
Thanks.
Comments
The way to go is actually to use filters to either divide it via serialisation of the content or add add new fields you then could store within the plugin_storage table.
You can also add fields, all kind of form elements, to the sidebar boxes (the multiple_layouts plugin for example does it with a drop down selector. My sideways plguin "featured_images" does it with a button.
Info on those filters here:
http://www.zenphoto.org/news/zenphoto-plugin-architecture#admin-filters
Beware that this is a bit more advanced coding.
If you can wait for the 1.4.6 release this would be a much better approach. The plugin can also add functions to handle the display of the data. A nice clean, encapsulated approach with little chance of conflicting with other plugins or theme uses of the custom data field.
I will probably use the 1.4.6 Development release, as I still have lots of background work to do on XAMPP before we release it publicly. It will also allow me to fine-tune the translation.
This is very barebones but functional. You can create and delete your own custom data fields. So far, only textbox, textarea and checkbox inputs are possible, but more are coming up.
BIG WARNING: Inputs are not really tested for security yet. So depending on who can use your backend this might be a big no go.
Feel free to check it out on github here: https://github.com/pju-/advanced_custom_data
If you have any questions, just let me know.
The new feature about plugins being able to create custom database fields sounds great btw. I guess I'll have to rewrite to accommodate to that.
One question about security: the number of people who have access to the back end will be very limited at the beginning (i.e. myself and 1-2 other people). The number of people who may upload pages and photos will increase, but it won't be "everyone" in the foreseeable future. So my security concern would be the following: Does it open a backdoor where any attacker (non-member, non-user) could corrupt the website?
The 1.4.6 release will tighten up these things. No scripts will be allowed in "normal" text fields and Codeblocks will have their own "rights" so that you can withhold them from your users.
We believe that we have good protection for XSRF attacks, so your users do not have to be "super careful". Still if they do not practice secure management of their computer someone could get to it and then have access to whatever you have allowed the user to do on your site.
Of course your testing and feedback would be greatly appreciated!