Posts tagged Ideas

WordPress Google Form Enhancements

0

Several people have asked for enhancements, many of which are similar. The most common request is to add either pre-filled or hidden fields based on something WordPress knows about. A recent request was to add tracking so a form could only be submitted by a user once. I am certainly not opposed to adding features like these, I think most would be pretty useful. However, there are some things to think about before implementing a solution or adding new features.

  1. To auto-fill a field or populate a hidden field, the field must be mapped from what the column is called on the Google Docs side of the form to something WordPress knows about (e.g. username, email address, etc.). How should this mapping be done? Arguments as part of the shortcode? For anything to be posted to the form processor on the Google side, the field must be defined on the form so the results spreadsheet has a corresponding column. For hidden fields, wpGForm would have to turn what is an existing field (which may or may not be a simple text box) into a hidden field with a value supplied by WordPress. This isn’t impossible, jQuery can do much of the work fairly easily but the problem is it is fraught with potential errors so I am reluctant to add it until I have a better idea how to bullet proof it. Pre-populating values is fairly easy, as long as we know what the field name
  2. I’ve considered, and posted about, introducing a Custom Post Type for forms. If I do this, then it makes addressing the tracking aspect fairly easy because the CPT id could be stored as part of the users meta data. That is pretty straight forward once the CPT exists (which it doesn’t yet). However, it does require the user to be logged into the site which many people don’t want to allow. This could also be handled by the CPT which could in theory, define a new form as anonymous or not. An anonymous form would have some limitations, tracking being one of them.

I’ve got some ideas on how to implement these features, most of which would be pretty useful. Introducing a CPT is absolutely on my radar screen but right now I am focused on my Swim Team plugin as we’re gearing up for Summer Swim Season here in North Carolina. Once I knock out my to-do list on the Swim Team plugin I’ll come back and look at adding the CPT for WordPress Google Forms which would facilitate adding some of the requests people have asked for.

Possible Enhancements for wpGForm

2

Recently I have had a couple requests for enhancements to wpGForm. One of the recent ones was the ability to define hidden fields on a form to capture some data from a WordPress user.

Currently Google’s forms define fields like this:

<input id="entry_0" class="wpgform_ss-q-short" type="text" value="" name="entry.0.single">

It would not be too hard to add an attribute like hidden=’entry_0,entry_2,
entry_27′ to the shortcode. I could even do something like
hidden=’entry_0=email,entry_2=username,entry_27=first_name,entry_28=last_name’ where the “allowable” presets would have to map to the fields which can be returned by get_userdata() see:
http://codex.wordpress.org/Function_Reference/get_userdata Of course all of this predicates that the user is logged in so those fields exist.

I’ve also considered changing the plugin to allow for more complicated things – adding more options to the shortcode could get pretty cumbersome. What’ve I thought about is doing leveraging the Dashboard (using a Custom Post Type) to Manage Forms where you “Add” a form and the Dashbaord provides a GUI where all sorts of information would be added:

1. Form URL
2. Confirmation URL
3. Switches for all of the other options (legal, read-only, etc.)
4. More things I haven’t thought about

Forms could then be “Edited/Deleted/etc.” just like other post types. Then you’d simply embed the form using a simple shortcode like . The rest of the information would be stored inWordPress as custom Post Type fields. I’d probably define a new shortcode for this so the current one would continue to work but that is the general idea.

Thoughts?

How to have a Meta Box appear before the Visual Editor

0

I am working on a new theme where I have defined a Custom Post Type.  This is my first time working with Custom Post Types and I must say they are pretty slick.  I wish they had existed back when I first started working on my Swim Team plugin!  I have far too much invested in my Swim Team plugin so I’ll stick with the custom database tables but for this new project, CPTs are working great.

Once I got my CPT defined and basically working, I wanted to add some custom fields to it using a Meta Box.  There are numerous articles that outline how to do it, I referenced this one quite a bit and found it very helpful.  In my instance, the Meta Box that holds all of the custom fields I want to collect is more important that the Visual Editor is so I wanted it to appear higher on the screen.

After poking through the Codex and number of Google searches, it appears that doing what I want to do isn’t native WordPress functionality.  I did however find this post which outlines an idea for moving the Meta Box so it appears on top of the Visual Editor.  Awesome.  Exactly what I was looking for. Except the code fragment didn’t work.  After looking at it, I decided the idea was sound but the implementation wasn’t correct or at least wasn’t correct in my application.

I tweaked the Javascript to make sure the document was ready before rearranging the Meta Box and Visual Editor and got the result I was looking for.  Here is the code I am using in my functions.php file.

/**
 * Set up a footer hook to rearrange the post editing screen
 * for the 'CPT' custom post type.  The meta box which has all
 * of the custom fields in it will appear before the Visual Editor.
 * This is accomplished using a simple jQuery script once the
 * document is loaded.
 */
function CPT_admin_footer_hook()
{
    global $post ;

    if (get_post_type($post) == 'CPT')
    {
?>
<script type="text/javascript">
    jQuery(document).ready(function($) {
        $('#normal-sortables').insertBefore('#postdivrich') ;
    }) ;
</script>

<?php
    }
}

/**  Hook into the Admin Footer */
add_action('admin_footer','CPT_admin_footer_hook');

wp-SwimTeam v0.2.484 available

A new version of wp-SwimTeam has been posted.  This releases fixes a couple minor bugs which prevented display of swim meet information in certain situations when scratching or registering from a swim meet.  This version also introduces two new features:

  1. Open or Close the registration system. When the registration system is open, users can register their swimmers for the current season.  When the registration system is closed, only an Admin or Editor can register swimmers.  This setting appears on the Registration tab from the Options sub-menu.
  2. Enable or disable user sign ups for jobs. When the job system is set for user sign ups, a user can sign up for any open job.  When the job system is set for admin sign up, users with either Admin or Editor roles can sign users up for jobs.  This second mode is good for teams where a paper or Excel list is used for job sign ups.  This setting appears on the Swim Team tab from the Options sub-menu.

Exploring Roles and Capabilities

I’ve had a request from my team, the MacDolphins, to be able to send e-mail to the parents of specific age groups.  We do a number of activities that are limited to older kids or only for a specific age group so I’ve been aware of this need for a while.  Unfortunately I don’t have an easy way to solve it.

I think the WordPress Roles and Capabilities functionality may be the answer to my problem.  I could create a role for each age group and assign the users that have a swimmer in that age group to the appropriate roles.  By doing this, I think I can continue to use the Email Users plugin to contact specific groups of users based on the roles defined.

I need to do more research on Roles and Capabilities.  I’ve played with a couple plugins and they aren’t real straight forward.

Working out volunteer management

I had done some work on volunteer management last year but put it aside to focus on other features.  I have picked it back up and found that one of the assumptions I had made last fall was completely wrong.

I concluded over the weekend that volunteers is three phases:

  1. Definition of volunteer roles which are referred to as “Jobs” within wp-SwimTeam.  The definition of a job includes the title, description, type of job, duration, where it is needed (home, away, both), and a few other details.
  2. Assignment of jobs to a season or meet.  Some jobs span a season, some are only for a meet.  The number of people needed to fill the jobs will differ from team to team and from pool to pool.  You might need 3 timers for a 6 lane pool but 4 for a 8 lane pool (assuming each team provides half the timers).
  3. Assignment of people to the jobs.  Once all of the jobs are defined and allocated for each meet and season, people need to sign up (or be assigned) to the jobs.  Initially I expect to only implement assignment and will add sign up later.

I’d be curious to know if anyone can think of a scenario that this won’t work for.  I’ve got phase 1 completed already and will start on phase 2 this week.

New wp-SwimTeam support forum

This evening I installed the Simple:Press forum plugin. This forum should be used for questions, bug reports, and anything else related to wp-SwimTeam. I will try and add some information on installing and configuring wp-SwimTeam soon but I am also considering adding a Wiki for documentation. Click on the Forum tab along the top of the page to access the forum.

Charting Results

As I work on results functionality I have several ideas floating around my head.  One is the ability to chart swimmer results over the course of a season or possibly several seasons.  Charting over several seasons raises some issues (e.g. different age groups, event distances, etc.) but charting results for at least one season would be interesting.

I had thought about using the same functionality that the WordPress.com Stats plugin uses which is Open Flash Chart to plot results.  Today while looking for something else, I may have found something which is a better solution:  pChart – a PHP library for building charts!

Hopefully I will get to try it out in the next few weeks.  I have been sidetracked by a WordPress project for my daughter’s soccer team so Swim Team will have wait a little longer.

Custom Reports for WinSwim

We use WinSwim to manage and run swim meets for the MacDolphins and now that our season has started, I have been doing a lot of work with WinSwim and not too much with wp-SwimTeam.  There are some things I need to fix but right now nothing is broken.

A year ago when I started using WinSwim I ended up creating a slew of custom reports mostly to deal with the fact that our pool is one of the few in the area which is a 25 meter pool – most are 25 yards.  We needed times in both meters and yards and the reports which came with WinSwim didn’t really handle it.  So I created a bunch of my own.  The only real downside of using custom reports is it required a file that is installed with WinSwim (language.xml) to be modified.  This was a maintenance headache as it would be overwritten with each WinSwim update.

WinSwim 4.0.21 introduced a new model for custom reports which removes the need to modify the language.xml file (yeah!).  Now each report is paired with a corresponding XML file and they all reside in a directory called “custom” within the WinSwim installation tree.

The reports are mostly geared around Heat Sheets and end of year reports.  To use the new reports, download the ZIP file and unzip into your top level WinSwim installation directory. 

WinSwim Custom Reportsv07-05, last updated on 2009-07-06

For example. in my case, I have WinSwim installed like this:

image

When the reports are installed correctly you will have a new “Custom” menu available in the Report Viewer as a new top level menu item to the right of “Reports”.  Note that the old “Custom” menu under the “Reports” but will still be there and will likely be empty unless you are using the old style of custom reports (which is still supported).

image

Go to Top