Discussion:
[GSoC - 2014] Introducing Myself
Deven Bansod
2014-02-10 06:46:20 UTC
Permalink
Hi! I'm a student from India. I am interested in participating in Google
Summer of Code - 2014 with WordPress.
I want to take up the "Forms Plug-in" project idea from the ideas page
[1]. Has there been any work on this? I guess that the idea would involve a
Plugin/Widget with a Settings Page to add new Surveys and Forms while also
providing the controls to edit the Saved surveys. Themes for the
Surveys/Forms and Other Complementary things can always be added later. As
per my understanding, the project would require a good amount of PHP and
WP-based interaction with the MySQL Databases along with JavaScript and
AJAX for Data Validation.

Please correct me on this if I am wrong and advise me on how to get started
and get more acquainted with the community / development process.

- My background -
I have developed two simple plugins for Wordpress [2],[3] and have a fair
knowledge of the process. I have worked on several hobby projects with PHP,
MySQL, JavaScript, AJAX and Python [4]. I have also programmed in C and
Visual Basic and have a know-how of svn. I am on the
SSMS(Student Society For Mess Services)
committee of my college, in which I'm responsible for developing and
maintaining a data oriented application to handle student billings. I was
also responsible for building a registration portal for an all-India event.

[1] http://codex.wordpress.org/?title=GSoC2014#Forms_Plugin
[2] http://wordpress.org/plugins/post-views-new
[3] http://wordpress.org/plugins/blog-tools
[4] http://github.com/devenbansod
--
* Thanks,Deven G. Bansod;*
* <***@pilani.bits-pilani.ac.in>*
Ian Dunn
2014-02-13 19:34:05 UTC
Permalink
Post by Deven Bansod
I want to take up the "Forms Plug-in" project idea from the ideas page
[1]. Has there been any work on this?
Hi Deven, thanks for your interest :)

The forms project is something that WordCamp Central (the team that
organizes the global WordCamp infrastructure and WordCamp.org) has
talked about and wanted for a long time, but we haven't written any code
for it yet, so the student who works on it will be able to build it from
the ground up.
Post by Deven Bansod
I guess that the idea would involve a Plugin/Widget with a Settings
Page to add new Surveys and Forms while also providing the controls
to edit the Saved surveys.
It would be a plugin and would most likely be created around Custom Post
Types.
Post by Deven Bansod
Themes for the
Surveys/Forms and Other Complementary things can always be added later.
It should be compatible with any theme, but that will mostly happen by
default. It will require some basic CSS rules to define the generic
layout of the forms on the front-end, but will inherit most of the
visual elements from whatever the current theme is.
Post by Deven Bansod
As
per my understanding, the project would require a good amount of PHP and
WP-based interaction with the MySQL Databases along with JavaScript and
AJAX for Data Validation.
Definitely good amounts of PHP and the WordPress API, and also some
JavaScript. AJAX could be involved, but it wouldn't necessarily have to
be. You can check out the WordCamp Organizer Application to see the kind
of branching that happens based on how the questions are answered:

http://plan.wordcamp.org/become-an-organizer/organizer-application/

There probably won't be much MySQL (if any); at least not directly. The
WordPress API handles 99% of that for you. I'd recommend playing around
with custom post types to get a feel for it:

http://codex.wordpress.org/custom_post_type
Post by Deven Bansod
Please correct me on this if I am wrong and advise me on how to get started
and get more acquainted with the community / development process.
Development for WordCamp.org happens on the Meta trac, and most of the
source code lives in the Meta repository. Other than that, the
processes, guidelines, etc are similar to the development of WordPress
itself.

Here's some links if you want to dig deeper:

WordCamps:

*
https://meta.trac.wordpress.org/query?status=accepted&status=assigned&status=new&status=reopened&status=reviewing&component=wordcamp.org&col=id&col=summary&col=status&col=owner&col=type&col=priority&col=component&order=priority
- WordCamp.org tickets on the Meta trac
*
https://meta.svn.wordpress.org/sites/trunk/wordcamp.org/public_html/wp-content/
- The SVN repo for WordCamp.org code
* http://central.wordcamp.org/ - The home page for WordCamp.org
* http://plan.wordcamp.org/ - Documentation about WordCamps. Mostly
geared towards WordCamp organizers, but there's lots of helpful
background info in there.

WordPress development in general:

* http://wordpress.org/about/philosophy/
* http://make.wordpress.org/docs/plugin-developer-handbook/
* http://make.wordpress.org/core/handbook/


Thanks for your interest and good luck with your application. Let me
know if you have any other questions.
Deven Bansod
2014-02-14 07:41:16 UTC
Permalink
Hi Ian! Thanks a lot For Replying so nicely to all my queries!

I will surely go through the links that you have posted and see what I can
take up from there.

Meanwhile, I will state what I had in my mind.

1. A *Settings Page* where you will design the Form through a user friendly
interface like what we use while designing forms using Google Forms. (*Please
suggest if this will be possible to make in the Required Duration* ).

2. The Settings page UI, thus, will be used to make new *Forms with an
unique ID*.

3. The Plugin will have a function to generate *a short code* which will
have *arguments like the Form ID* etc.

4. The user can just go to the *'page/post'* that he wants to add the
survey and *use the Short Code with the right ID *as an argument and get
the survey running. !

Thanks,
Deven Bansod
* <***@pilani.bits-pilani.ac.in>*
Ian Dunn
2014-02-19 23:40:37 UTC
Permalink
Post by Deven Bansod
1. A *Settings Page* where you will design the Form through a user friendly
interface like what we use while designing forms using Google Forms. (*Please
suggest if this will be possible to make in the Required Duration* ).
That's the basic idea, yeah. It would actually be a custom post rather
than a Settings page, though.
Post by Deven Bansod
2. The Settings page UI, thus, will be used to make new *Forms with an
unique ID*.
3. The Plugin will have a function to generate *a short code* which will
have *arguments like the Form ID* etc.
4. The user can just go to the *'page/post'* that he wants to add the
survey and *use the Short Code with the right ID *as an argument and get
the survey running. !
Yeah, that's all correct. There'll also be some features specific to
WordCamp.org, like supporting pre-defined base forms that organizers can
customize. For instance, a "Call for Speakers" form that potential
WordCamp speakers can fill out. It would have some standard fields like
Name, E-mail Address, WordPress.org username, etc, but then the
organizers could also add their custom questions to the form.

Another feature we're thinking about is having the results of certain
forms automatically populate some of our other custom post types. For
example, when someone fills out the Call for Speakers form, it could
automatically create a drafted Speaker post, so that the organizers
don't have to copy/paste the data between the two.
Deven Bansod
2014-02-21 10:57:51 UTC
Permalink
Hii Ian!

Thanks a ton for being so patient and helping me understand the idea well.!

I want to get a clear idea of exactly what we are going to do ! So I keep
asking you more and more Questions while presenting my own ideas as well.
And here comes again !

*Please correct me if I am wrong in the Following Idea!*

The Basic Process of Making a New Form would be as follows :

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) -> New Form will have *a base form* (as you suggested). 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)*

2) The '*Administrator publishes the Form'*. The Form is available to
Public to fill out.

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)

4) The Administrator may go to '*Settings Page'* where he would be able to
view, edit, export the "*Submitted Forms*", viewed Form_ID wise.

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. !

Regards,
Deven Bansod
Post by Ian Dunn
Post by Deven Bansod
1. A *Settings Page* where you will design the Form through a user friendly
interface like what we use while designing forms using Google Forms. (*Please
suggest if this will be possible to make in the Required Duration* ).
That's the basic idea, yeah. It would actually be a custom post rather
than a Settings page, though.
2. The Settings page UI, thus, will be used to make new *Forms with an
Post by Deven Bansod
unique ID*.
3. The Plugin will have a function to generate *a short code* which will
have *arguments like the Form ID* etc.
4. The user can just go to the *'page/post'* that he wants to add the
survey and *use the Short Code with the right ID *as an argument and get
the survey running. !
Yeah, that's all correct. There'll also be some features specific to
WordCamp.org, like supporting pre-defined base forms that organizers can
customize. For instance, a "Call for Speakers" form that potential WordCamp
speakers can fill out. It would have some standard fields like Name, E-mail
Address, WordPress.org username, etc, but then the organizers could also
add their custom questions to the form.
Another feature we're thinking about is having the results of certain
forms automatically populate some of our other custom post types. For
example, when someone fills out the Call for Speakers form, it could
automatically create a drafted Speaker post, so that the organizers don't
have to copy/paste the data between the two.
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Regards,Deven G. Bansod;*
IInd Year Student
B.E.(Hons.) Computer Science + M.Sc.(Hons.)Economics(Dual Degree)
*Contact : * *Gmail* <***@gmail.com>* BITS Mail
<***@pilani.bits-pilani.ac.in>* *Alternate Email
<***@yahoo.co.in>*

*Birla Institute of Technology & Science,* Pilani
Pilani Campus, Rajasthan 333 031, INDIA
* <***@pilani.bits-pilani.ac.in>*
Ian Dunn
2014-02-21 17:26:07 UTC
Permalink
Post by Deven Bansod
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.
Post by Deven Bansod
New Form will have *a base form* (as you
suggested).
Yeah, probably a dropdown of pre-defined forms, like "Speaker Proposal",
"Volunteer Application", etc.
Post by Deven Bansod
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.
Post by Deven Bansod
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.
Post by Deven Bansod
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.
Post by Deven Bansod
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.
Post by Deven Bansod
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
Deven Bansod
2014-02-24 07:59:27 UTC
Permalink
Hi Ian!

I thought I should just make my current progress on the idea clear to you
so that you can help me in a better way. So writing this mail.

As you have always been doing, please correct me where ever I am wrong or
there is a better way to do it.

I have been conceptualizing the process of how everything will work out in
the Plugin and the functions that we may require. I am also thinking about
the features that we want to add and how exactly to go about it so as to
implement them.

I have made out the basic structure of the shortcodes which will be used to
generate the forms(done for the simple forms. For Complex ones, I have to
think).
'Any suggestions over the Improvements/Shortcomings here are most welcome'

For Example : The UI for the Form Making will generate this sort of Short
Code which will be displayed as a Proper Form in the Form Page where ever
the Form is Placed.

"
[form_start]

[element type='text' label='Name'/]
[element type='text' label='Gender' option='M,F'/] // Will produce two
Radio Buttons with M and F as Labels and Original Label as Gender

[/form_start]

"

For the Forms and Responses from the Forms, I read about the Custom Post
Types from the links you provided and some other links too and the basic
structure of the CPTs for forms and form_feedbacks have been laid down.

For the UI to make the Forms, I have made a Custom App( using AJAX and PHP)
(Currently Independent of WP and with limited functionality but the idea is
clear) which can be used to make the custom forms(starting from the Base
Forms). I just have to figure out a way to integrate it with WP and the its
done. 'Any Help on this would be most Welcome'.

The Email to the Admin things can be done by simply plugging the Values
into a Predefined Mail Format and using wp_mail() function.

The Feature about automatically creating the Draft of the Speakers' Post
that you told in the Previous Mail is quite interesting and would automate
a lot of work and they should be and can be incorporated into the Plugin.
And I have been trying to figure out a way to do that . I was thinking on
lines of using the Function 'wp_insert_post' with the right Variable values
to do that.



Regards,
Deven
* <***@pilani.bits-pilani.ac.in>*
Nicholas Ciske
2014-02-24 15:27:01 UTC
Permalink
I'd not advise pursuing this approach to shortcodes...

A single shortcode to output the form by id or name is the current (and best) practice.

See: every other form plugin available for WordPress.

Running dozens of short codes to output a form that's already been designed on the backend? That's going to use a lot of resources -- for what gain? Not to mention how brittle this approach is... e.g. can I intermix other shortcodes within a form? What if those also output a <form> element, breaking your form?

PS- Always prefix your shortcodes to avoid collisions with other plugins & themes.

_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske
Post by Deven Bansod
For Example : The UI for the Form Making will generate this sort of Short
Code which will be displayed as a Proper Form in the Form Page where ever
the Form is Placed.
"
[form_start]
[element type='text' label='Name'/]
[element type='text' label='Gender' option='M,F'/] // Will produce two
Radio Buttons with M and F as Labels and Original Label as Gender
[/form_start]
"
Deven Bansod
2014-02-24 16:33:39 UTC
Permalink
Thanks Nick !

I had not realized that. ! Thanks for pointing it out. ! :)

I will now take it into account and start thinking of an alternative way to
do it where I just have to take in the Form ID/Name as arguments for the
short code.

I have an idea that User would make the form with the UI(opening in a new
iframe I guess from a Button in post.php?post_type=form)
and then save it. The Plugin will save the final HTML of the Form in the
"post_content" in "wp_posts" as "Draft" with CPT of "form".

User can use the Shortcode in any post/page with the Form ID if they want
or can just publish this 'form' as it is.

Will keep the mailing list posted on any new development ! Suggestions and
Advices are always welcome. !

Thanks.

Regards,
Deven
Post by Nicholas Ciske
I'd not advise pursuing this approach to shortcodes...
A single shortcode to output the form by id or name is the current (and best) practice.
See: every other form plugin available for WordPress.
Running dozens of short codes to output a form that's already been
designed on the backend? That's going to use a lot of resources -- for what
gain? Not to mention how brittle this approach is... e.g. can I intermix
other shortcodes within a form? What if those also output a <form> element,
breaking your form?
PS- Always prefix your shortcodes to avoid collisions with other plugins & themes.
_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske
Post by Deven Bansod
For Example : The UI for the Form Making will generate this sort of Short
Code which will be displayed as a Proper Form in the Form Page where ever
the Form is Placed.
"
[form_start]
[element type='text' label='Name'/]
[element type='text' label='Gender' option='M,F'/] // Will produce two
Radio Buttons with M and F as Labels and Original Label as Gender
[/form_start]
"
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
*Regards,Deven G. Bansod;*
IInd Year Student
B.E.(Hons.) Computer Science + M.Sc.(Hons.)Economics(Dual Degree)
*Contact : * *Gmail* <***@gmail.com>* BITS Mail
<***@pilani.bits-pilani.ac.in>* *Alternate Email
<***@yahoo.co.in>*

*Birla Institute of Technology & Science,* Pilani
Pilani Campus, Rajasthan 333 031, INDIA
* <***@pilani.bits-pilani.ac.in>*
Nicholas Ciske
2014-02-24 16:51:00 UTC
Permalink
Deven,

Please download a few popular form plugins and see how they handle things -- they've already solved the problems you're facing -- the beauty of open source is that you can learn from other's code.

http://formidablepro.com
http://wordpress.org/plugins/ninja-forms/

Making a new form in an iframe popup is a interesting idea -- would be good for quick forms. However, is that the workflow users will use? Or will they author the the form and them want to insert it into (possibly multiple) posts/pages/widgets? I'm not saying either way is correct, I'm asking you to evaluate the best workflow for your users before making architectural decisions.

Saving the HTML is probably not what you want to do -- forms are dynamic things -- so the are generally best generated each time, so they can take into account the current state (required fields, errors, etc). i.e. Save the meta data about the form in custom fields on the custom post type instead, then generate the form when it's viewed.

_________________________
Nick Ciske
http://thoughtrefinery.com/
@nciske
Post by Deven Bansod
Thanks Nick !
I had not realized that. ! Thanks for pointing it out. ! :)
I will now take it into account and start thinking of an alternative way to
do it where I just have to take in the Form ID/Name as arguments for the
short code.
I have an idea that User would make the form with the UI(opening in a new
iframe I guess from a Button in post.php?post_type=form)
and then save it. The Plugin will save the final HTML of the Form in the
"post_content" in "wp_posts" as "Draft" with CPT of "form".
User can use the Shortcode in any post/page with the Form ID if they want
or can just publish this 'form' as it is.
Will keep the mailing list posted on any new development ! Suggestions and
Advices are always welcome. !
Thanks.
Regards,
Deven
Deven Bansod
2014-02-25 11:19:29 UTC
Permalink
Hi!
@Teja

: Thanks ! I will keep that in mind now on! :)

@Nick : Thanks a lot for the guidance. I will surely checkout the way in
which these plugins work. ! Will keep you posted!

Meanwhile, I had thought of an UI like this and I wanted to have
suggestions on that.

Loading Image...

@Ian :
The Feature
,
that you suggested for the base forms
,
can be added as shown.

The Form Builder Meta


Box will help the user to build the Forms. As soon as the User Clicks the
'Add New Element' button, the 'New Element' Box Pops up. User Fills out all
the Properties related to this Element which will include all the
conditions, custom error msgs, parent field and all
and clicks 'Add'
.
The New element gets added to the Form(not shown here) and the New
Element Popup goes away.
(Not many
element
properties have been shown here,
They
will be added later)

Thus,

the User does this for all the Elements and then clicks 'Save the Form'.
Now all the Meta Data is stored and the Form can be published.

The area besides the New Element Box will continuously show the Live Form
fields and their order which can be changed by simple drag and drop.

Once the Form is saved, The Plugin will automatically generate a
*
Form
_
ID
*
that will be passed onto post-content to show up when the form is loaded.
The Plugin will generate the JS required for simple fields validation
automatically from the Properties that user enters for the Element while he
was adding it.

The Plugin may also provide an option to add a few lines before the actual
form starts. For example, the lines written in the text

box shown in the right!

Once the Structure for the forms and UI for the form making has been
finalized, I will start

thinking

on how the submitted forms will be handled and presented to the admin. !

Please provide your feedback on this and correct me if I am wrong
anywhere. ! :)

Thanks.

Regards,
Deven


P.S. : Congrats to all GSoC 2014 Aspirants ! WordPress Selected as a
Mentoring Organization !
Eric Hendrix
2014-02-25 11:22:42 UTC
Permalink
Ajax? I'm interested in your solution. —
Eric A. Hendrix
***@gmail.com
910-644-8940
Post by Deven Bansod
Hi!
@Teja
: Thanks ! I will keep that in mind now on! :)
@Nick : Thanks a lot for the guidance. I will surely checkout the way in
which these plugins work. ! Will keep you posted!
Meanwhile, I had thought of an UI like this and I wanted to have
suggestions on that.
http://i.imgur.com/YrHWFC4.png?1
The Feature
,
that you suggested for the base forms
,
can be added as shown.
The Form Builder Meta
Box will help the user to build the Forms. As soon as the User Clicks the
'Add New Element' button, the 'New Element' Box Pops up. User Fills out all
the Properties related to this Element which will include all the
conditions, custom error msgs, parent field and all
and clicks 'Add'
.
The New element gets added to the Form(not shown here) and the New
Element Popup goes away.
(Not many
element
properties have been shown here,
They
will be added later)
Thus,
the User does this for all the Elements and then clicks 'Save the Form'.
Now all the Meta Data is stored and the Form can be published.
The area besides the New Element Box will continuously show the Live Form
fields and their order which can be changed by simple drag and drop.
Once the Form is saved, The Plugin will automatically generate a
*
Form
_
ID
*
that will be passed onto post-content to show up when the form is loaded.
The Plugin will generate the JS required for simple fields validation
automatically from the Properties that user enters for the Element while he
was adding it.
The Plugin may also provide an option to add a few lines before the actual
form starts. For example, the lines written in the text
box shown in the right!
Once the Structure for the forms and UI for the form making has been
finalized, I will start
thinking
on how the submitted forms will be handled and presented to the admin. !
Please provide your feedback on this and correct me if I am wrong
anywhere. ! :)
Thanks.
Regards,
Deven
P.S. : Congrats to all GSoC 2014 Aspirants ! WordPress Selected as a
Mentoring Organization !
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Deven Bansod
2014-02-25 11:50:04 UTC
Permalink
Hi Eric!

Ya. I have just conceptualized the Workflow till now!
I hope most of the things I am Planning for, will be done by JS and AJAX
with a little PHP in the backend.

I am attaching two empty divs for Element Properties(Shown) and One for
Live Form Fields(Not shown) in the Meta Box itself.

Once an User clicks the Add Element button JS comes into Pic and it creates
a small form for taking in the Properties. Then as the user clicks 'Add'
button, AJAX enters. It sends it to a Handler PHP in the background which
in turn stores the current situation of the form in wp_postmeta.

This continues till all the elements are done.!

Then as the User clicks Save the Form. The Handler.php(in the Plugin
Folder) finalizes everything and passes the Form_ID into post_content which
plugin will use to display the Form when a Responder sees it.

Finally enter all the other fields on the post.php and click on 'Publish'
(Here 'Update'). And You are done !

Please correct me if I am wrong anywhere. Also advice if something may not
be possible to do or if there is a better way to do it.

Regards,
Deven
* <***@pilani.bits-pilani.ac.in>*
Ian Dunn
2014-03-01 23:26:44 UTC
Permalink
Hi Deven, sorry for the delayed response, but it sounds like you're
heading in the right direction :)
Post by Deven Bansod
The Form Builder Meta
Box will help the user to build the Forms. As soon as the User Clicks the
'Add New Element' button, the 'New Element' Box Pops up. User Fills out all
the Properties related to this Element which will include all the
conditions, custom error msgs, parent field and all
and clicks 'Add'
Popups are almost always a bad idea because users hate them and most
browsers block them, so instead you'd want to use a modal box. The Core
API provides one that can be used by plugins.

It's also worth considering if it'd be better to just do everything
inline, but a modal may be a better approach depending on how much data
will need to be collected about each element, etc.
Post by Deven Bansod
The Plugin may also provide an option to add a few lines before the actual
form starts. For example, the lines written in the text
box shown in the right!
That's probably unnecessary, since the user can just add that to the
page itself before they add the shortcode that renders the form.
Post by Deven Bansod
Then as the User clicks Save the Form. The Handler.php(in the Plugin
Folder) finalizes everything and passes the Form_ID into post_content which
plugin will use to display the Form when a Responder sees it.
WP already provides a standard AJAX handler (/wp-admin/admin-ajax.php),
so it's best to use that instead of a custom one.



It's great to see that you're very enthusiastic about the project, but
I'd caution against getting too deep into it at this stage. Once we
accept an application, we'll get into more detail about the project
specs and work through some things that still need to be decided, so any
code you write today may not be applicable tomorrow.

I think that, right now, any potential applicant would be better served
by spending their time learning to implement the fundamental features
that are common in plugins, and also brushing up on best practices for
WordPress development.

* actions and filters
* input validation / output sanitization, nonces, current_user_can()
* custom post types and custom taxonomies
* the settings api
* shortcodes
* how WP handles AJAX
* wp_cron
* multisite
* unit testing (phpunit and qunit)
* etc
Deven Bansod
2014-03-02 03:57:55 UTC
Permalink
Hi Ian!
Thanks a lot for that Guidance! I needed just that.!

I was thinking about the Modal Thing only
,
but
I got the nomenclature wrong. I had seen the
*ThickBox Library* for WordPress for that. Can this be used for the
Modals?

Anyways, I had been thinking too much about the Plugin itself and not the
overall WP coding standards and all the other things you have mentioned. I
will definitely go over through all this to get a much better idea how all
the things and features, that we have discussed, would be implemented in WP
and also refreshing the best practices and fundamental features in Plugin
Development.

Also, I will start working on the Application soon and will post the Link
here, once I am done. It would be great if you could suggest any
improvements/shortcomings in that.



Thanks again! :)
Will keep you posted on the Thread.

Regards,
Deven
Ian Dunn
2014-03-02 18:44:59 UTC
Permalink
Post by Deven Bansod
I had seen the
*ThickBox Library* for WordPress for that. Can this be used for the
Modals?
Thickbox is still available, but it's no longer maintained upstream, so
it's better to try and reuse the 3.5 Media modal if possible. See #10955.
Deven Bansod
2014-03-03 16:21:43 UTC
Permalink
Hi Ian!
I will look into the Media Modal thing but I think it may not even be
required. But at first, as you had rightly suggested, I am now
concentrating more on reading more and more about the general WP
development techniques, pre-reqs and getting the basics clear.!

Thanks.

Regards,
Deven
* <***@pilani.bits-pilani.ac.in>*
Deven Bansod
2014-03-09 20:47:40 UTC
Permalink
Hi Ian!
I have been reading more about the general WP Development recently. I must
say, it is helping me a lot. I am realizing the things that I mostly would
forget or take for granted without knowing why am I doing it. I think my
coding style would see a nice shift from what I had coded in the Simple
Plugins that I wrote to what I would develop after reading this.

Also, I have trying to think more about the Problems that may arise in
implementing the Plugin. The most prominent one that I could think of was
of Preventing the Spam (I guess, always a major problem in Forms). The
Sanitizing Functions like esc_ functions,data validation functions,
sanitize functions etc that I read about will be useful here. Any more
Ideas/suggestions would be more than welcome here.

I am working on my project application now.
Will keep you informed. :)

Regards,
Deven
Ian Dunn
2014-03-10 19:18:59 UTC
Permalink
Post by Deven Bansod
I have been reading more about the general WP Development recently. I must
say, it is helping me a lot. I am realizing the things that I mostly would
forget or take for granted without knowing why am I doing it.
Hi Deven, I'm glad to hear it's helping :)
Post by Deven Bansod
Also, I have trying to think more about the Problems that may arise in
implementing the Plugin. The most prominent one that I could think of was
of Preventing the Spam (I guess, always a major problem in Forms). The
Sanitizing Functions like esc_ functions,data validation functions,
sanitize functions etc that I read about will be useful here. Any more
Ideas/suggestions would be more than welcome here.
Validating and sanitizing data isn't specific to a forms plugin or spam
-- it's necessary for any plugin dealing with any data that isn't
hardcoded -- but it's definitely good to learn about and will be a
requirement for the plugin.

For spam specifically, there are lots of traditional options like
CAPTCHAs and hidden form fields to trap bots, but another possibility is
using the Akismet API -- http://akismet.com/

It'd be a good idea to take a look at the Jetpack forms module and see
what option(s) they use.
Deven Bansod
2014-03-10 19:27:30 UTC
Permalink
Hi Ian !

Okay. I will look into JetPack Forms as well as Akismet to learn more about
it.


Meanwhile, I have prepared a rough application draft for the Project
Description on my blog.
Here is the Link<http://devenbansod.wordpress.com/2014/03/11/project-description/>to
it ! : GSoC
2014 Proposal<http://devenbansod.wordpress.com/2014/03/11/project-description/>

It would be great if you could just review it and suggest any
changes/shortcomings in my Application.

Thanks.

Regards,
Deven
* <***@pilani.bits-pilani.ac.in>*
Ian Dunn
2014-03-11 17:29:19 UTC
Permalink
Post by Deven Bansod
Meanwhile, I have prepared a rough application draft for the Project
Description on my blog.
Thanks Deven, this looks good :)

Here's a few things to take into consideration:

* Because the plugin will use custom post types, it's not necessary to
bulid a custom CSV exported. WordPress' export tool will already
recognize the data and is able to export it just like it would with
standard posts and pages.

In general, it's always best if you can leverage Core's API to do
something in a standard way, rather than reinventing the wheel.


* JavaScript can be used for data-validation on the client-side, to give
the user immediate feedback when they enter something invalid, but it's
important to remember that it also needs to be validated on the
server-side, since nothing on the client side can be trusted from a
security standpoint.

Validating on the client side is optional and improves UX, but
validating on the server side is mandatory to prevent things like SQL
injection.

http://codex.wordpress.org/Data_Validation
http://wordpress.tv/2011/01/29/mark-jaquith-theme-plugin-security/


* It's important to use gender-neutral language. The WordPress community
has a very high percentage of women involved at all levels, and using
only masculine pronouns can be unintentionally dismissive and exclusive.

I'm sure that you didn't mean anything like that; it's a hard habit to
get out of and something I catch myself doing too. But it's important
that we encourage each other to be more inclusive and keep each other
accountable.

More background info and alternatives are available at
http://geekfeminism.wikia.com/wiki/Nonsexist_language


Other than that, your proposal looks good and is on the right track. If
you haven't already, just make sure you're following the other
discussions about the Forms project on wp-hackers and #wordpress-gsoc so
that you can learn from them as well.



I also noticed you've got a few plugins in the wordpress.org repository,
which is great! That'll give you valuable experience and help you get
started quicker if your proposal is accepted. I took a quick look at
them and have a few suggestions:

* Instead of echo'ing HTML via PHP, you can close the PHP tag and output
the HTML raw, with PHP tags inserted as needed. That makes it much
easier to read.

For example:
https://plugins.trac.wordpress.org/browser/google-authenticator-per-user-prompt/trunk/views/token-prompt.php


* Rather than issuing SQL queries directly, you can almost always
achieve the same results with the WordPress API. For example,
get_posts() instead of SELECT * FROM $wpdb->posts.

That is generally easier, more performant, more secure and more
future-proof.

http://codex.wordpress.org/Function_Reference can be helpful to get an
learn what's available to you.


* It's important to use meaningful variable names. Names like $a and $r
require anyone reading the code to go through it line by line to figure
out what it's doing, rather than it being obvious.


* It's best to follow the WordPress coding standards at
http://make.wordpress.org/core/handbook/coding-standards/ so that your
code is consistent with the rest of the community.


Thanks for the work you've put into your proposal and plugins, and good
luck with the process. Let me know if there's anything I can do to help.
Deven Bansod
2014-03-11 18:36:17 UTC
Permalink
Hi Ian ! Thanks for the wonderful Advices and Thoughts. !
Post by Ian Dunn
* Because the plugin will use custom post types, it's not necessary to
bulid a custom CSV exported. WordPress' export tool will already recognize
the data and is able to export it just like it would with standard posts
and pages.
In general, it's always best if you can leverage Core's API to do
something in a standard way, rather than reinventing the wheel.
Oh. Yes ! That would be make it really much simpler. And yes, doing the
same thing, for which a better solution is already available won't make
sense. ! This is how I am understanding the power of Open Source!
Post by Ian Dunn
* JavaScript can be used for data-validation on the client-side, to give
the user immediate feedback when they enter something invalid, but it's
important to remember that it also needs to be validated on the
server-side, since nothing on the client side can be trusted from a
security standpoint.
Validating on the client side is optional and improves UX, but validating
on the server side is mandatory to prevent things like SQL injection.
Yes. I have been thinking on the same lines that JS will provide the UX
improving things such as Prompts to check a blank submission and all. And
yes I fully understand that Server side Validation will be most important
with preventing SQL injections and we can then provide the options for
Unique Applicants and many such things to build on it. !
Post by Ian Dunn
* It's important to use gender-neutral language. The WordPress community
has a very high percentage of women involved at all levels, and using only
masculine pronouns can be unintentionally dismissive and exclusive.
Thanks for this one ! The newbies in the Developer culture (like me) tend
to forget these small but very important details. It was nice of you to
remind us about it. I will surely take care of it in future.
Post by Ian Dunn
Other than that, your proposal looks good and is on the right track. If
you haven't already, just make sure you're following the other discussions
about the Forms project on wp-hackers and #wordpress-gsoc so that you can
learn from them as well.
Yes, I have been regularly following the other Discussions on the Forms
Project on the wp-hackers and I must say others doubts, ideas or your and
others suggestions/replies to them has helped me learn alot and answers
half of my questions there only. I will now try to be present on
#wordpress-gsoc chats too.
Post by Ian Dunn
I also noticed you've got a few plugins in the wordpress.org repository,
which is great! That'll give you valuable experience and help you get
started quicker if your proposal is accepted. I took a quick look at them
* Instead of echo'ing HTML via PHP, you can close the PHP tag and output
the HTML raw, with PHP tags inserted as needed. That makes it much easier
to read.
* It's important to use meaningful variable names. Names like $a and $r
require anyone reading the code to go through it line by line to figure out
what it's doing, rather than it being obvious.
* It's best to follow the WordPress coding standards at
http://make.wordpress.org/core/handbook/coding-standards/ so that your
code is consistent with the rest of the community.
I had read the Coding Standards at the start but there I had neglected
it. But now, recently I have been working on beautifying my code of the 2
plugins, changing the Variable Names to some logical ones and would be
issuing a new commit to the plugins soon. I now understand that in any
piece of code, its readability impacts how other developers perceive your
code.

I would make all these suggested changes and then submit my proposal.



Anyways, thanks alot Ian ! For helping us out all these days and being
patient enough to answer all our queries/doubts so nicely.

It has a been great Experience to interact with all on the list. Hoping to
continue and grow our interaction in coming days!

Thanks.!

Cheers,
Deven
* <***@pilani.bits-pilani.ac.in>*

Teja Amilineni
2014-02-25 12:01:43 UTC
Permalink
@Deven - This is interesting. Meanwhile, I have been thinking if post meta
is a good way to implement the forms? Each form would a number of
sub-elements and attributes. Can this be handled? Would it be better off
having a new data type. Most of the forms plugins seem to do it this way...
Post by Deven Bansod
Hi!
@Teja
: Thanks ! I will keep that in mind now on! :)
@Nick : Thanks a lot for the guidance. I will surely checkout the way in
which these plugins work. ! Will keep you posted!
Meanwhile, I had thought of an UI like this and I wanted to have
suggestions on that.
http://i.imgur.com/YrHWFC4.png?1
The Feature
,
that you suggested for the base forms
,
can be added as shown.
The Form Builder Meta
Box will help the user to build the Forms. As soon as the User Clicks the
'Add New Element' button, the 'New Element' Box Pops up. User Fills out all
the Properties related to this Element which will include all the
conditions, custom error msgs, parent field and all
and clicks 'Add'
.
The New element gets added to the Form(not shown here) and the New
Element Popup goes away.
(Not many
element
properties have been shown here,
They
will be added later)
Thus,
the User does this for all the Elements and then clicks 'Save the Form'.
Now all the Meta Data is stored and the Form can be published.
The area besides the New Element Box will continuously show the Live Form
fields and their order which can be changed by simple drag and drop.
Once the Form is saved, The Plugin will automatically generate a
*
Form
_
ID
*
that will be passed onto post-content to show up when the form is loaded.
The Plugin will generate the JS required for simple fields validation
automatically from the Properties that user enters for the Element while he
was adding it.
The Plugin may also provide an option to add a few lines before the actual
form starts. For example, the lines written in the text
box shown in the right!
Once the Structure for the forms and UI for the form making has been
finalized, I will start
thinking
on how the submitted forms will be handled and presented to the admin. !
Please provide your feedback on this and correct me if I am wrong
anywhere. ! :)
Thanks.
Regards,
Deven
P.S. : Congrats to all GSoC 2014 Aspirants ! WordPress Selected as a
Mentoring Organization !
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Deven Bansod
2014-02-25 12:38:38 UTC
Permalink
Ya, I understand that it would require a lot of rows. Will think about it
and tell .

But Sorry could not understand you on 'new data type'. Are you suggesting
to make a Separate table in the DB for storing all the things related to a
form ?
* <***@pilani.bits-pilani.ac.in>*
Loading...