agileware / wp-civicrm-ux

WordPress CiviCRM UX - User Experience enhancements
GNU General Public License v2.0
7 stars 12 forks source link

How to /can we display contact address #8

Closed jbonlinea closed 2 years ago

jbonlinea commented 3 years ago

Hi there,

Is it possible to display civi contact primary address, or any address with this module ?

I have successfully used the plug-in to display contact details like such [ux_contact_value field=first_name] but one contact may have several address and addresses are "mult-field", so basic implementation like above do not work (or I haven't guessed what were the address field names)

Thank's for this very usefull plug-in

agileware-justin commented 3 years ago

@jbonlinea Try using field=address_formatted in the shortcode to return a formatted address. See https://github.com/agileware/wp-civicrm-ux/blob/master/shortcodes/contact/value.php#L51

If that doesn't produce the required output then it may require a bit of work to implement as a new field or field handler similar to the above.

Another method we use fairly frequently is to set up a Data Processor output and then use the ux_civicrm_listing shortcode to display the value on a page, see https://github.com/agileware/wp-civicrm-ux/blob/master/USAGE.md#civicrm-data-list-using-the-civicrm-data-processor - this method opens up a lot of interesting possibilities. Is a bit fiddly to get working, but once it does - definitely cheers all round :)

agileware-justin commented 3 years ago

Just a FYI. This is now possible as we've implemented the ability to call the CiviCRM APIv4 directly via shortcode.

We haven't updated the documentation yet (sorry!), but the feature was introduced with this commit, https://github.com/agileware/wp-civicrm-ux/commit/0fcc53d4791ba09c91d0787ace6dac8db91f7122

jbonlinea commented 3 years ago

:+1:

excellent thank's

ps : I've dug in the data processor, but there are so many options to set, and cracks in my knowledge (for instance what output shoud I select to be able to use the data in your plug-in) that I went an other road :)

agileware-justin commented 2 years ago

CiviCRM APIv4 shortcode is the way to go here, https://github.com/agileware/wp-civicrm-ux/blob/1.11.0/USAGE.md#civicrm-apiv4-shortcode