admin-page-framework
admin-page-framework copied to clipboard
Frontend Visitor Input Fields
Can this be used to add frontend forms that are safe for anonymous user input?
I'm in the middle of converting my own plugins to use Admin Page Framework. Would keep the code lighter if I can use the fields on the frontend too.
Hi,
It's not supported at the moment, sorry. However, it sounds like a good idea.
Thank you, Michael. Would love to see it added.
I've dome some experimentation with front-end forms, using the APF form class. It came out to be functional. One thing to keep in mind is that you have to style the form by yourself.
If you like, you should try this demonstration plugin. Please make sure you have Admin Page Framework v3.8.11 or above.

The demo plugin consists of four files.
- admin-page-framework-frontend-form-beta.php - the plugin bootstrap file.
- AdminPageFramework_FormBeta_frontend.php - an extended form class. (you don't have to pay too much attention to this one.)
- AdminPageFramework_FrontendFormBeta_Base.php - a base class that provides methods to set up front-end forms.
- AdminPageFramework_FrontendFormBeta.php - a class which extends the above base class and do necessary set-ups for the form.
For the usage, please see the doc-block section of the AdminPageFramework_FrontendFormBeta_Base class. Basically, you set up a custom hook and define fields and a stylesheet in an extended class. And then just instantiate the extended class. The demo plugin uses the the_content filter hook as an example. You can set your custom filter/action in your desired location. It should be strait forward. Modify the AdminPageFramework_FrontendFormBeta class and play around with it. It might be easier than writing one from scratch.
Hope you like it. Let me know if you encounter problems.
Wow! Thank you very much. Will download and play with this in a few minutes.
- Nice work, have you added Frontend_Base to the core or I'll have to use it as an add-on?
- Where it would store the submission data?
@wowthemes It's not part of the core. You have to implement it by yourself. It's just a matter of copy & paste and renaming classes though.
The submission data is not stored anywhere by itself. You want to do it by yourself in the validate() method. Just do something like update_option( $first_parameter, 'your_option_key' ) where $first_parameter is the first parameter variable of the validate() method.