CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Limiting the Country options in a Standalone Form or Directory
Pages: [1]

Author Topic: Limiting the Country options in a Standalone Form or Directory  (Read 6565 times)

gibsonoliver

  • I post occasionally
  • **
  • Posts: 65
  • Karma: 2
    • Northbridge Digital
Limiting the Country options in a Standalone Form or Directory
July 16, 2013, 03:24:27 am
Hi

We have a directory, based on a profile, which allows members of the public to search for yoga teachers.
We would like the directory to only allow searching by 2 countries (United Kingdom - ID 1226, Ireland - 1105) but we also need to still have all countries available in CiviCRM.
See http://drunetwork.com/civicrm/profile?reset=1&gid=13

The country select field array values are generated by this line in proximitycommon.php
$country = array('' => ts('- select -')) + CRM_Core_PseudoConstant::country();
How could we alter this array so that only those 2 options are available (with the correct value/label)?

With thanks
Oliver

Oliver Gibson, Northbridge Digital

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Limiting the Country options in a Standalone Form or Directory
July 16, 2013, 11:39:45 pm
You will need to do that either by creating an .extra template that removes the select options from the forms where you do not want them, or create a buildForm hook for your profile. Are you familiar with the concepts of customizing CiviCRM? If not, check this link book.civicrm.org/developer
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Limiting the Country options in a Standalone Form or Directory
July 17, 2013, 02:50:54 am
if you are on drupal you should be able to do this by limiting the filter on a View to only the two countries you want
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

gibsonoliver

  • I post occasionally
  • **
  • Posts: 65
  • Karma: 2
    • Northbridge Digital
Re: Limiting the Country options in a Standalone Form or Directory
July 17, 2013, 06:00:45 am
Hi

Thanks Erik, that's probably the best way to go.

Sorry Pete, I probably wasn't clear enough in my post. They are using a CiviCRM directory based on a profile as you can't get proximity searches to work via Drupal Views. For now I've hidden the Country field but it still defaults to the UK allowing proximity searching.
See - http://drunetwork.com/civicrm/profile?reset=1&gid=13

Cheers
Olly
Oliver Gibson, Northbridge Digital

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Limiting the Country options in a Standalone Form or Directory

This forum was archived on 2017-11-26.