1

I am loading an email template for custom registration via a plugin. I reset the template path and load my template like this:

    $oldPath = craft()->path->getTemplatesPath();
    $newPath = craft()->path->getPluginsPath().'businesslogic/templates';
    craft()->path->setTemplatesPath($newPath);
    $bodyhtml = craft()->templates->render('emailreg.html', array(
        'user' => $user
    ));

In my html template ( an evil abomination of tables etc ) I am accessing the user variable {{user.firstname}} just fine. But the other variable $user->mycustomfield will not render - even though I can send it in the subject line, e.g.,

$email->subject = 'New User Registration: ' . $user->firstName . ' ' . $user->registrationNumber;

So whats up here?

3
  • Weird/flaky this is a real blocker now. I can get other profile fields with user.myfield but not the one i want.....
    – joomkit
    Commented Apr 25, 2017 at 22:34
  • Solved: had changed the user object variable so that one field was empty. Fine now. Phew
    – joomkit
    Commented Apr 25, 2017 at 22:37
  • Can you please post an official answer, or close the question?
    – carlcs
    Commented Apr 26, 2017 at 6:31

1 Answer 1

1

The above template path code works fine. I was just looking for a user variable that hadn't yet been set

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.