[wp-hackers] Fwd: [GSoC - 2014] Introducing Myself
Ian Dunn
ian at iandunn.name
Fri Feb 21 17:26:07 UTC 2014
On 2/21/14, 2:57 AM, Deven Bansod wrote:
> 1) Website '*Admin*istrator' will go to '*Forms'* in the main admin
> nav menu -> Click on a '*Add New'* Form Button(Till this Its same as
> we do for a New Post) ->
Yup, exactly.
> New Form will have *a base form* (as you
> suggested).
Yeah, probably a dropdown of pre-defined forms, like "Speaker Proposal",
"Volunteer Application", etc.
> He will *customize it* and den Save the Form(Auto-save
> Draft may do this) or directly Publishes it. *(Editor has to be
> designed for this ! Have a basic idea, but Cant seem to figure out
> how exactly would we do this on Post.php)*
The Custom Post Types API takes care of most of it. You basically just
pass the paramaters that define the post type to register_post_type(),
and it creates a post type that has all the functionality of a normal
post/page out of the box.
From there, you can add meta boxes with add_meta_box() and save data in
the postmeta table by hooking into the `save_post` action.
If you want to play around with custom post types a little bit,
http://codex.wordpress.org/register_post_type would be a good place to
start. There are also tons of tutorials online.
> 2) The '*Administrator publishes the Form'*. The Form is available
> to Public to fill out.
Right, like you mentioned earlier there'd probably be a shortcode that
you could pass an ID to, so that they could embed the form into a post
or page.
> 3) A '*Foreign User fills out the Form & Submits'*. As He submits,
> the submitted Data is stored in *'form_submissions' table* inside the
> WP database itself(Can be queried by using the "Form_ID" field)
Rather than creating a custom database table, it'd be better to create a
second post type to store submissions. It'd have a piece of metadata to
link it back to the form ID that it is associated with.
> 4) The Administrator may go to '*Settings Page'* where he would be
> able to view, edit, export the "*Submitted Forms*", viewed Form_ID
> wise.
If we create a second post type for submissions, then WP will
automatically display the submitted forms for us, and we'll just have to
add a meta box to display the custom fields.
The admins should also get an e-mail when a new submission is saved. It
should contain all the data and a link to the post in the Admin Panels.
> Now I am slightly lost on the last feature that you mentioned ! It
> would be great if you could just help me on that one. !
WordCamp.org has custom post types for Speakers, Organizers, Sponsors
and Sessions. So, when you see a Speakers page on a WordCamp site, like
http://2014.stlouis.wordcamp.org/speakers-list/, it's being build
automatically from the data stored in the Speakers posts.
Right now organizers have to manually copy and paste the data (like
their name and WordPress.org username, which is used to pull in their
Gravatar) into the Speakers post from the form that potential speakers
filled out.
That's something that can be automated, though. When the form is filled
out, we can check if it's based on one of the pre-defined forms. If it's
based on the Speaker Proposal form, then we can automatically create a
drafted Speaker post with the speaker's name, WordPress.org username, etc.
That will save organizers a lot of time and effort. They would just have
to publish the speakers they choose and leave the others as a draft,
rather than having to manually create all the posts.
You can see the source code for the Speaker/etc post types at
https://meta.trac.wordpress.org/browser/sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types
More information about the wp-hackers
mailing list