I copied the mimemail-message.tpl.php file into my theme's directory and I wanted to print the recipient's e-mail address.

I did this using:

<?php
print $recipient;
?>

The first several times I did this, it printed the recipient's e-mail address.

However, after awhile, I started receiving this error:
Recoverable fatal error: Object of class stdClass could not be converted to string in include() (line 39 of /srv/bindings/b81d191a00ba47918fed128c2b472257/code/sites/all/themes/omtheme/mimemail-message.tpl.php).

Inspecting with dpm(), I saw that somehow instead of returning the recipient's e-mail address the module began returning the user object of the recipient.

Which is it supposed to return?

Comments

sgabe’s picture

The $recipient is either a string, a user object or an array. In your custom theme you should implement THEME_preprocess_mimemail_message(&$variables) with something like this:

$recipient = $variables['recipient'];
if (is_array($recipient)) {
  $variables['recipient'] = $recipient['mail'];
}
elseif (is_object($recipient)) {
  $variables['recipient'] = $recipient->mail;
}
ptmkenny’s picture

Status: Active » Fixed

Thank you! That did the trick!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

added my latest findings on this issue