1

Very new to plugin stuff and taking baby steps so forgive me if this is obvious.

I have a simple notification service set up to send an email to the author of an entry (front end submitted) when it is saved.

This simply sends the email to $entry->author

The entry that gets submitted also has a related entry field and I'd like to send the author of that entry an email as well, but I'm not sure how I'd get access to them? Any pointers?

1

Something like this should do it:

// Grab an entry.
$entry = craft()->entries->getEntryById(4);

// The current entry's author.
$originalAuthor = $entry->getAuthor();

// This is assuming your Entries field is called "relatedEntry"
$relatedEntry = $entry->relatedEntry->first();

// Make sure one was selected.
if ($relatedEntry)
{
    // The related entry's author.
    $relatedEntryAuthor = $relatedEntry->getAuthor();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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