Opened 10 years ago
Closed 10 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 )
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)
Change History (9)
#1
@
10 years ago
- Description modified (diff)
- Keywords good-first-bug added
- Summary changed from "Country" ticket question to CampTix "Country" question type
#2
@
10 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
@
10 years ago
Hey Deven, thanks for the patch :)
Overall it looks good, but there are a few things I think we should change.
- We don't need to show the list of countries in the back-end, or save it in the
postmeta
for everytix_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. question_field_country()
, etc should be inaddons/field-country.php
rather thancamptix.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.- The patch should be compliant with WP's coding standards (braces around single lines, etc).
- Escape output as late as possible, e.g., during the
printf
rather than the$country = ...
- 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
@
10 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 :
- Hard-coded the list to output directly to the front-end. Removed the values input from the Add Question form.
- Changed it accordingly.
- Have modified a bit. Hope it satisfies now.
- Changed it appropriately.
- 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.
#5
@
10 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
@
10 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
Patch for #558 Meta