WordPress.org

Making WordPress.org

Opened 5 years ago

Closed 5 years ago

#558 closed enhancement (fixed)

CampTix "Country" question type

Reported by: vanillalounge Owned by:
Milestone: Priority: normal
Component: WordCamp Site & Plugins Keywords: good-first-bug reporter-feedback needs-testing
Cc:

Description (last modified by iandunn)

It would be very useful for WordCamps with regular visitors from other countries (WordCamp Europe, for one, as well as most city WordCamps in Europe), to know the origin of their attendees. We've manually created a dropdown for WCEU14, but it has been needed before.

A new "Country" question type would avoid having to manually enter the list of countries.

Attachments (2)

patch_558_meta.diff (6.5 KB) - added by bansod_deven 5 years ago.
Patch for #558 Meta
patch_558_meta_2.diff (6.1 KB) - added by bansod_deven 5 years ago.
Patch_2 for #558 Meta

Download all attachments as: .zip

Change History (9)

#1 @iandunn
5 years ago

  • Description modified (diff)
  • Keywords good-first-bug added
  • Summary changed from "Country" ticket question to CampTix "Country" question type

@bansod_deven
5 years ago

Patch for #558 Meta

#2 @bansod_deven
5 years ago

  • Keywords reporter-feedback needs-testing added

I added a New Question Type as 'Country' in the Camptix Plugin
(Checked out from : https://plugins.svn.wordpress.org/camptix/trunk).

Its similar to Select Dropdown question type except that it automatically fills the "Values" Text box and makes it ReadOnly.

Rest the working remains same.

Patch Added!

#3 @iandunn
5 years ago

Hey Deven, thanks for the patch :)

Overall it looks good, but there are a few things I think we should change.

  1. We don't need to show the list of countries in the back-end, or save it in the postmeta for every tix_question, we can just output the hardcoded list on the front-end for the visitor, similar to how the Twitter and URL fields don't ask for anything.
  2. question_field_country(), etc should be in addons/field-country.php rather than camptix.php, because addons shouldn't modify core CampTix (just like WordPress plugins don't modify Core files). It's fine to add it to $default_addons, though.
  3. The patch should be compliant with WP's coding standards (braces around single lines, etc).
  4. Escape output as late as possible, e.g., during the printf rather than the $country = ...
  5. Remove debugging code like // echo $country;

Also, where did the list of countries come from? We'll want to make sure it matches the official ISO 3166-1 list.

#4 @bansod_deven
5 years ago

Hi Ian, thanks for pointing this things out.! I have to slightly careful from now on.

Adding a 2nd Patch

Changed the Following from what you had mentioned :

  1. Hard-coded the list to output directly to the front-end. Removed the values input from the Add Question form.
  2. Changed it accordingly.
  3. Have modified a bit. Hope it satisfies now.
  4. Changed it appropriately.
  5. Removed.

The List of Countries from ISO 3166 List I found now was at : https://commondatastorage.googleapis.com/ckannet-storage/2011-11-25T132653/iso_3166_2_countries.csv

Let me know if this source list is trustworthy. Also the list mentions some nations as Independent, some as Proto Independent or Dependent. I am unable to choose what to include and what to not.

Suggest changes if any.

@bansod_deven
5 years ago

Patch_2 for #558 Meta

#5 @iandunn
5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

That source looks good, and I think we should include them all.

I made a few small changes before committing:

  • Added selected() to the <option> elements, so the chosen value will be selected if there's an error during submission and the form is redisplayed, and when editing an attendee.
  • Setup the country list as an array to begin with, rather than a string that gets converted to an array.
  • Sorted the array alphabetically.
  • Removed the [camptix_attendee] callbacks after I realized we probably don't want the country showing up in attendee list.

Committed in bdd615d.

Thanks Deven :)

#6 @bansod_deven
5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Hey Ian, don't you think it would be good if we keep a boolean in the [camptix_attendee] shortcode as [camptix_attendee show_country=1] to choose if they want to output the country and keep a default value as 0(false). ??

Came across a case in #698

#7 @iandunn
5 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

I think it'd be better to leave this ticket closed since the initial goal of it has been accomplished, and then discuss the rest in #698.

Note: See TracTickets for help on using tickets.