Invisimail settings not being set properly

ronan - April 30, 2008 - 15:51
Project:Email Field
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:reviewed & tested by the community
Description

I've found that the invisimail settings being set by this module are not applying every time, and in fact only seem to work when the an invisimail filter is run prior to the rendering of the email field (and therefore only when the filter cache is invalidated).

The cause seems to be the check to see if the link setting is set:

<?php

      $format
= $GLOBALS['invisimail_format'];
      if (!(
variable_get('invisimail_link_'.$format, TRUE))) {    
       
variable_set('invisimail_link_'.$format, TRUE);
       
variable_set('invisimail_js_'.$format, TRUE);
      }
?>

If the invisimail filter has not been run then $GLOBALS['invisimail_format'] is empty and the variable name being checked is 'invisimail_link_'. Since this variable is also empty and the default being passed to variable_get is TRUE the call is returning true and the if block is being skipped.

By changing the default to FALSE the block gets run and the 'invisimail_link_' and 'invisimail_js_' are both set:

<?php

     
if (!(variable_get('invisimail_link_'.$format, FALSE))) {    
       
variable_set('invisimail_link_'.$format, TRUE);
       
variable_set('invisimail_js_'.$format, TRUE);
      }
?>

This may not be the cleanest way to accomplish this, especially since if $GLOBALS['invisimail_format'] is set then the email module is overwriting the settings for whatever input format was last filtered.

The attached patch sets $GLOBALS['invisimail_format'] to 'email_field' so that the email.module can set it's own values for these settings and not interfere with the settings of the input filters:

<?php
      $format
= "email_field";
     
$GLOBALS['invisimail_format'] = $format;
      if (!(
variable_get('invisimail_link_'.$format, FALSE))) {    
       
variable_set('invisimail_link_'.$format, TRUE);
       
variable_set('invisimail_js_'.$format, TRUE);
      }
     
$mailto = invisimail_ascii_encode($item['email']);
?>

Hope this helps out.

AttachmentSize
invisimail_settings.patch726 bytes

#1

ronan - October 31, 2008 - 15:52

Here's another patch to make the 5.x version of email compatible with the 5.x-1.0 invisimail api.

Ronan

AttachmentSize
email-invisimail-api.patch 821 bytes

#2

ericnielsen - September 30, 2009 - 19:31
Status:needs review» reviewed & tested by the community

I did exactly what ronan did IN COMMENT #1 before coming to this issues list. I think this is correct and should be committed.

 
 

Drupal is a registered trademark of Dries Buytaert.