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 CiviMail (Moderator: Piotr Szotkowski) »
  • {domain.address} token formatting
Pages: [1]

Author Topic: {domain.address} token formatting  (Read 2148 times)

mac

  • I post occasionally
  • **
  • Posts: 71
  • Karma: 0
{domain.address} token formatting
March 16, 2010, 08:21:23 am
I'm trying to add the {domain.address} token into the footer of the newsletter I'm working on.

What I would like to achieve is to have the parts of the address all in one line as opposed to starting a new line for the address, city, postal code, etc.

Can somebody please give me a hint how to modify the standard behavior and get rid of the line breaks?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: {domain.address} token formatting
March 16, 2010, 09:44:54 am

can u modify the format in a url similar to:

http://drupal.demo.civicrm.org/civicrm/admin/setting/preferences/address?reset=1

and remove the newline between addresses and see if it fixes your issue

thanx

lobo

A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

mac

  • I post occasionally
  • **
  • Posts: 71
  • Karma: 0
Re: {domain.address} token formatting
March 16, 2010, 10:24:59 am
Lobo, thank you for the feedback.

I understand though that this will change the display for all addresses, not only for the domain address.

Is there no way how to actually just change the display of the domain address? And in particular the display of it within an email (footer)?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: {domain.address} token formatting
March 16, 2010, 11:32:21 am

your other option would be to use the mailAlter hook, but there are a few unresolved issues with this so it wont work right now (which will be fixed in 3.2)

you can go modify the code here:

CRM/Utils/Token.php, function getDomainTokenReplacement

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

mac

  • I post occasionally
  • **
  • Posts: 71
  • Karma: 0
Re: {domain.address} token formatting
March 16, 2010, 11:34:10 am
thanks. I'm not sure whether I want to touch that though ...

mac

  • I post occasionally
  • **
  • Posts: 71
  • Karma: 0
Re: {domain.address} token formatting
March 23, 2010, 01:46:54 pm
I have dared to reformat the address formatting so that the whole address is one line, but I still have another problem.

Although I write my footer template like this:
Quote
You can also mail us a written request to the attention of: {domain.name}, {domain.address}.

It "arrives" like this:
Quote
You can also mail us a written request to the attention of: Our Company Name,
Our address, our city, province, country
.

Why does CiviCRM add a line break after the domain tags/values?

I'd like to have it all in one line, like this:
Quote
You can also mail us a written request to the attention of: Our Company Name, Our address, our city, province, country.

Is there a way how I can change this?

Piotr Szotkowski

  • Moderator
  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: {domain.address} token formatting
March 25, 2010, 04:31:23 pm
Quote from: mac on March 23, 2010, 01:46:54 pm
Why does CiviCRM add a line break after the domain tags/values?

I think it wraps the {domain.address} in newlines.

Can you try fixing this by changing the CRM_Utils_Address::format() function in the CRM/Utils/Address.php file, e.g. by changing the lines containing code looking like the below:

Code: [Select]
$formatted = preg_replace('/…/u', "\n", $formatted);
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • {domain.address} token formatting

This forum was archived on 2017-11-26.