This is the recommended way to register configurations for Pods via PHP: https://docs.pods.io/code/registering-configurations/
Dear Scott,
Thank you very much for your answer.
I also tried these ways to register pods (either with JSON files or with PHP).
Nevertheles, each method makes these pods non-editable…. -> there is no way (AFAIK) to add/modify fields, either with PHP or from UI.
Is there a way to make them appear/editable the same ways as PODS registered from the database ?
In general, is there any way to register PODS with the same results as the ‘wp pods pod add…’ WP-CLI command ? (this command register a new pod in the database and gives the same results as registering it from the UI)
Thank you in advance
Best regards
Xerviami
-
This reply was modified 2 years, 9 months ago by
xerviami.
Hi @xerviami
Since such configurations are static I don’t understand why you want to be able to edit them. Can you explain your situation and requirements?
Cheers, Jory
Hi @keraweb ,
> Since such configurations are static…
My need is to have non-static POD creation/modification (same flexibility as UI creation, but with code). Therefore configurations are not a convenient way to perform it.
My use case is:
- user A creates from the frontend the CPT/POD n°1 -> he becomes the owner of this pod and will be able to add fields, modify its label, … or delete it (other users may be owners of other PODS)
- other users are able to add/create/delete Items based on CPT/POD n°1
I do not want to let user A access to the admin page because he would have access to some pod configurations that I do not want to (such as API enabling, pod template, admin page configuration, …).
Therefore I am re-coding a way for user A to input his new CPT/POD informations from the frontend (name, fields, …) and I wand to pass these informations to a method which programmaticaly creates or modifies the POD.
At this stage, the only way I found is by using WP-CLI.
Thank you in advance.
Xerviami
-
This reply was modified 2 years, 9 months ago by
xerviami.
-
This reply was modified 2 years, 9 months ago by
xerviami.
Hi @xerviami
Static config files are indeed not meant for such situations.
Since you require a very dynamic way of creating and modifying Pods you will need to create an abstraction layer for this to have support for Pods owners etc.
Pods just created the Pod objects, which do not include owners or visibility options itself, you’re either the admin or you’re not.
You do have such options with the content created with these Pods (like Posts and Terms).
@sc0ttkclark do you have any recommendations on such a situation?
Cheers, Jory