$form->addElement('radio', "email[$blockId][is_primary]", '', '', '1', $js);
if (CRM_Utils_System::getClassName($form) == 'CRM_Contact_Form_Contact') {
-
- $form->add('textarea', "email[$blockId][signature_text]", ts('Signature (Text)'),
- ['rows' => 2, 'cols' => 40]
- );
-
- $form->add('wysiwyg', "email[$blockId][signature_html]", ts('Signature (HTML)'),
- ['rows' => 2, 'cols' => 40]
- );
+ // Only display the signature fields if this contact has a CMS account
+ // because they can only send email if they have access to the CRM
+ if (!empty($form->_contactId)) {
+ $ufID = CRM_Core_BAO_UFMatch::getUFId($form->_contactId);
+ if ($ufID) {
+ $form->add('textarea', "email[$blockId][signature_text]", ts('Signature (Text)'),
+ ['rows' => 2, 'cols' => 40]
+ );
+ $form->add('wysiwyg', "email[$blockId][signature_html]", ts('Signature (HTML)'),
+ ['rows' => 2, 'cols' => 40]
+ );
+ }
+ }
}
}
}
<tr id="Email_Block_{$blockId}">
<td>{$form.email.$blockId.email.html|crmAddClass:email} {$form.email.$blockId.location_type_id.html}
- <div class="clear"></div>
- {if $className eq 'CRM_Contact_Form_Contact'}
+ {if $className eq 'CRM_Contact_Form_Contact' and !empty($form.email.$blockId.signature_html.html)}
+ <div class="clear"></div>
<div class="email-signature crm-collapsible collapsed">
<div class="collapsible-title">
{ts}Signature{/ts}