Skip to content

Instantly share code, notes, and snippets.

@hertsch
Last active August 29, 2015 13:56
Show Gist options
  • Save hertsch/9000508 to your computer and use it in GitHub Desktop.
Save hertsch/9000508 to your computer and use it in GitHub Desktop.
Helpfile for the kitCommand Contact

~~ contact ~~

Introduction

For a general help to the kitCommands, the usage and the general available parameters please refer the kitCommand help.

Parameters

###action[]

Tells Contact the action to perform, supported are:

  • action[form] - execute the form specified with the additional parameter form[]
  • action[list] - show a list of contacts, use the parameter filter[] to limit the result to your needs.
    Important: For security reasons action[list] will only return active contacts which are assigned to a category with public access
  • action[register] - show a dialog to register a contact for a category with public access
  • action[search] - show a dialog to search for contacts with public access. Use the parameter categories[] and tags[] to restrict the search to the given categories and/or tags.
  • action[view] - show the content record specified with the parameter contact_id[], use the parameter edit[] to enable frontend editing. A kitCommand with the parameter action[view] can also be used as target for the Category Target URL.

Sample:

~~ contact action[list] ~~

###categories[]

The parameter categories[] can be used in context with parameter action[register] to assign one or more categories to a contact to register. If you specify more than one categories, a choice dialog will be shown and the user must select one category he want to assign to the contact.

You can specify a category_id or a category_name as value, separate multiple values by comma.

Sample:

~~ contact action[register] categories[customer] ~~

will select the category with the name customer - no choice dialog will be shown.

Sample:

~~ contact action[register] categories[1,3] ~~

will show a choice dialog with the categories 1 and 3 (the names will be shown) for selection.

The parameter categories[] can also be used in context with parameter [action[search]]. If you pass the parameter without any value (empty), the search dialog will show a select field to choose the category. If you specify one or more categories the search will be restricted to the given categories.

Sample:

~~ contact action[search] categories[customer] ~~

will restrict the search to the category customer.

Sample:

~~ contact action[search] categories[] ~~

will show an additional select field beneath the search field to choose the category where the search should be performed.

###contact_id[]

The parameter contact_id[] can be used in context with parameter action[view] to tell the kitCommand to show the contact record for the given contact_id.

Sample:

~~ command action[view] contact_id[12] ~~

will show the contact record for the ID 12.

###edit[]

The parameter edit[] can be used in context with the parameter action[view] to enable Contact Administrators and the Contact Owner to edit the current shown contact record in the frontend.

edit[] does not need any value, just add the parameter to enable editing and remove it to disable this function.

###filter[]

The parameter filter[] can be used in context with the parameter action[list].

The filter[] is mighty and enable you to filter contacts for different aspects. You can specify one or more key=value pairs within the filter, separate them with a pipe |. Supported are the following keys:

  • category - specify one or more category IDs or category names separated by comma. The filter will only process categories with a public access
  • city - you can filter for cities. city=bad will find cities like Bad Herrenalb or `
  • contact_type - specify the contact type, which can be PERSON or COMPANY. By default the filter will select both types, you can specify the contact type: contact_type=PERSON will select only PERSON contacts.
  • country - you can specify one or more country codes (2-characters, ISO), i.e. country=de,ch will select Germany and Switzerland
  • order_by - by default the filter sort the result by the field order_name, you can specify any field of the table contact_overview.
  • order_direction - by default the filter will order the result in ascending ASC order, you can set the direction to descending using the value DESC: order_direction=DESC
  • limit - by default the filter will return at maximum 100 contact records, you can set any other integer value to limit the returned result
  • state - you can filter for one or more states: state=bay,würt may find Bayern or Baden Württemberg
  • tag - you can filter to one or more tag names, separate them by comma. tag=COMMENTS,NEWSLETTER will filter for contacts which have set the tag COMMENTS or NEWSLETTER.
  • zip - filter for zip codes. This filter assume that you are searching for the first digits of the zip: zip=14 will find all zips which start with 14. You can add multiple zips, separate them by comma: zip=135,137,14 will find all zips starting with 135, 137 or 14.

###form[]

With the parameter form[] you can specify the form to execute, this parameter need also the action[] parameter set to action[form].

Sample:

~~ contact action[form] form[sample_contact] ~~

How to create and use forms is described in a own section of the Contact Wiki.

###map[]

The parameter map[] can be used in context with the parameter action[view] to tell the kitCommand to show a Google Map with the location beneath the contact record.

To enable the map to show the correct location, the contact record should contain a nearly complete address of the location.

The parameter map[] does not need any values, leave the brackets empty.

Sample:

~~ contact action[view] contact_id[12] map[] ~~

will show the contact record for the ID 12 and a map with the location.

###tags[]

The parameter tags[] can be used in context with the parameter action[search]. If you specify one or more tags, the search will be restricted to this tags. If you leave the parameter empty, an additional tag select field will be shown beneath the search field.

Sample:

~~ contact action[search] tags[butcher,baker] ~~

will search only for public contacts with the assigned tags butcher or baker.

Sample:

~~ contact action[search] tags[] ~~

will show an additional select field for the tags beneath the search field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment