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) »
  • Weird functionality of the Signature token
Pages: [1]

Author Topic: Weird functionality of the Signature token  (Read 2537 times)

Freya von Moltke-Foundation

  • I post occasionally
  • **
  • Posts: 32
  • Karma: 1
  • CiviCRM version: civiCRM 4.7.19
  • CMS version: Wordpress 4.8
  • MySQL version: 5.1.73
  • PHP version: 5.6.30
Weird functionality of the Signature token
August 11, 2011, 07:46:49 am
Hello everybody,

I am having a bit of troubles understanding the functionality of the signature token CiviCRM  offers to apply for Emails and Letters to be printed out. I have been searching for forum post explaining it and reading the handbook for help, but I didnt even found the signature token anywhere mentioned.
So what I mean to use for our letters is a signature like that (under the text message) as a contact reference:

Person X (in whose name the email is send)
Freya von Moltke-Foundation
Address
emailaddress
internetaddress homepage

I set up a signature like that for somebody from our foundation sending out loads of Emails in her name, that has a contact account and FROM Email address configured on our CiviCRM platform.
Now when i send an email using her FROM Email address and include the {contact.signature_text} token, her signature is NOT used. This is not surprising, as the signature token is refering to the contact(s) the email is going to (thats why its including "contact", I see that).
This is what I dont understand now. I mean why would I want to include the contacts signature in an email to him or her, and not one of my organization (or the person in my organization sending the email)? Maybe I am just totally misunderstanding this token, but I dont see its use the way its working so far.

By the way, I know I could include my organization's signature in the footer sending bulk mails or in the message templates, which is what we are gonna do then I guess as this token is not working. I am just confused what its use is supposed to be then, I mean i also dont see where I can set up a default signature used for all contacts or something like that, then it could be made use of.

Can anyone enlighten me about this? Please also say if i am just understanding this token wrong, I would just like to know what its for.
Thanks,
Anja

bartclarkson

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5.x
Re: Weird functionality of the Signature token
January 23, 2013, 08:10:39 am
I was also surprised by this token.  It makes sense from a contact data object standpoint, but it's useless as a practical matter, as Anja clearly described.

Here's Drupal 7 module hook code to get at the acting user's signature data, html and text. 

Code: [Select]
function hook_utilities_civicrm_tokens(&$tokens) {
  $tokens['acting_user'] = array(
    'acting_user.signature_html' => 'Acting User: Signature HTML',
    'acting_user.signature_text' => 'Acting User: Signature Text',
  );
}

function hook_utilities_civicrm_tokenValues(&$values, $contact_ids , $job = null, $tokens = array(), $context = null) {

  global $user;
  $result= civicrm_api('UFMatch','Get', array('version' =>3, 'uf_id' => $user->uid));

  $signature_text = '';
  $signature_html = '';

  if (isset($result['values'][$result['id']]['contact_id'])) {
    $contact_id = $result['values'][$result['id']]['contact_id'];
    $query = "SELECT signature_text, signature_html FROM civicrm_email WHERE contact_id = $contact_id LIMIT 1";
    $dao = CRM_Core_DAO::executeQuery($query);   
    while($dao->fetch()) {
      $signature_text = $dao->signature_text;
      $signature_html = $dao->signature_html;
    }
  }
 
  foreach ($contact_ids as $contact_id) {
    $values[$contact_id]['acting_user.signature_text'] = $signature_text;
    $values[$contact_id]['acting_user.signature_html'] = $signature_html;
  }

}

Cheers.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Weird functionality of the Signature token
January 23, 2013, 10:37:40 am
Not sure why there is a token for the contact signature. The feature was implemented for use in the 'Send Email' and 'Send Email to Contacts' workflows (as opposed to CiviMail bulk mailings). In these workflows, if the selected FROM email address has a signature associated with it - that signature is appended to the email message. I not sure there's any valid use cases for the signature in the CiviMail context.
Protect your investment in CiviCRM by  becoming a Member!

adrian.mahlstein

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
Re: Weird functionality of the Signature token
May 14, 2013, 04:31:47 pm
@bartclarkson: This is exactly what I need :) Just wondering - where do I put this code? Not familiar at all with real codes. Thanks for your help. Adrian

Detlev

  • I post occasionally
  • **
  • Posts: 68
  • Karma: 2
    • Software für Engagierte e.V.
  • CiviCRM version: 4.5
  • CMS version: Drupal
Re: Weird functionality of the Signature token
December 05, 2013, 09:29:52 am
We currently have the need for this functionality within a CiviCRM implementation project.

I have just one question: The functionality as described below by Dave Greenberg: Is that a standard feature of CiviCRM?

Or is the Drupal 7 module hook code mentioned by bartclarkson (reply #2) required for this?

I am asking because I did not get it to work...


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: Weird functionality of the Signature token
December 05, 2013, 09:41:35 am

hey detlev:

pretty sure u'll need to use bart's module for this

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

Detlev

  • I post occasionally
  • **
  • Posts: 68
  • Karma: 2
    • Software für Engagierte e.V.
  • CiviCRM version: 4.5
  • CMS version: Drupal
Re: Weird functionality of the Signature token
December 05, 2013, 11:45:33 pm
Hi Lobo,

thanks for that quick answer!

Is there a reason, why this module isn't in the core? Without of that functionality, the signature field doesn't make any sense, imho.

I am asking, because I want to avoid any custom coding for this client - they do not have own resources for updating any custom code...


Detlev

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Weird functionality of the Signature token
December 06, 2013, 10:01:15 am
Detlev - As I mentioned above, the intended functionality for the signature (which should work out-of-the-box) is to allow someone who uses the Send Email to Contact(s) to have an automatically inserted signature block in the email text.

Screenshot 1 - I've set a signature for my contact record.
Screenshot 2 - I start to compose an email and my signature is automatically inserted

The use case of including this signature block via token in CiviMail output is not currently handled in core - but is clearly useful. Bart's module is a good start - but I think it would be preferable to have a token that grabs a signature based on the FROM email address rather than on the logged in user's contact signature (signatures are attached to specific email address entries in the DB).

The changes would look something like this IMO:
* Add tokens to core for from_email.signature_html and from_email.signature.text (token titles might be 'Sender Signature' or 'FROM Signature') which grab signatures by looking up the FROM email associated with the mailing
* Remove the existing contact.signature_html and contact.signature_text tokens (they don't seem useful and are confusing)

Anyone up for putting together a patch for 4.5 for this?
Protect your investment in CiviCRM by  becoming a Member!

Detlev

  • I post occasionally
  • **
  • Posts: 68
  • Karma: 2
    • Software für Engagierte e.V.
  • CiviCRM version: 4.5
  • CMS version: Drupal
Re: Weird functionality of the Signature token
December 07, 2013, 12:03:59 am
Oops, Dave and all:

Quote
Detlev - As I mentioned above, the intended functionality for the signature (which should work out-of-the-box) is to allow someone who uses the Send Email to Contact(s) to have an automatically inserted signature block in the email text.

Screenshot 1 - I've set a signature for my contact record.
Screenshot 2 - I start to compose an email and my signature is automatically inserted

The use case of including this signature block via token in CiviMail output is not currently handled in core - but is clearly useful. Bart's module is a good start - but I think it would be preferable to have a token that grabs a signature based on the FROM email address rather than on the logged in user's contact signature (signatures are attached to specific email address entries in the DB).

This is exactly what I wanted to achieve - but I simply did not get it to work ...

But I am very happy as you tell, that this is the standard feature with CiviCRM. So I will continue configuring that to work. Just in case, I won't succeed, I might post again here ...

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Weird functionality of the Signature token

This forum was archived on 2017-11-26.