Sender options Full name, Site name, Does not work.

Comments

danepowell’s picture

Yeah, this is not working... very annoying. There is something seriously messed up about how messages are getting 'built', such that the sender information is not getting filled. But I suspect this is causing other problems as well.

I don't understand enough about the relationship between messaging 'methods', 'objects', and what the 'messaging simple' class is supposed to do to implement a proper fix. However, a quite hackish but workable solution is to add the following lines to the start of the message_prepare() function in messaging_mail.inc:

<?php
    $sender = user_load($message->uid);
    $message->sender = array('name'=> $sender->name, 'uid' => $message->uid);
?>
danepowell’s picture

Nevermind... that works when sending a test message but not when sending via cron. I'm guessing because no user is actually logged in. I'm not sure if that's a separate issue or not.

danepowell’s picture

Okay I think this works- insert in the same place as in #1:

<?php
$objects = $message->get_template()->get_objects();
if (isset($objects['node'])) {
  $sender = user_load($objects['node']->uid);
  $message->sender = array('name'=> $sender->name, 'uid' => $sender->uid);
}
?>