<p>Something like this should do it:</p>

<pre><code>// Grab an entry.
$entry = craft()-&gt;entries-&gt;getEntryById(4);

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

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

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

CC BY-SA 3.0
2017-09-08T17:28:56.493Z
2017-09-08T17:28:56.493Z
Brad Bell
<p>Very new to plugin stuff and taking baby steps so forgive me if this is obvious.</p>

<p>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. </p>

<p>This simply sends the email to <code>$entry-&gt;author</code></p>

<p>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?</p>

<plugin-development><emails><author>
Get a related entries author in a plugin
# Get a related entries author in a plugin

(Asked by: username_0 on 2017-09-07)

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?

**Tags:** plugin-development, emails, author

---

## 1 answers

### Answer by username_1 on 2017-09-08. Score: 1 | Accepted answer

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();
}


---

