How to check if a user has any entries they're an author of... in a plugin? This seems pretty simple in a template; along the lines of

if( craft.entries.authorId(10) | length ){ ... }


But how do I do that from a plugin?

craft-&gt;entries-&gt;authorId(10)


doesn't seem to exist and I've been banging my head against the docs not knowing what I'm actually looking for...

[EDIT]

I now have the following code:

$entryCriteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$entryCriteria-&gt;authorId = $existingUser-&gt;id;
$existingPages = $entryCriteria-&gt;find();

if ($existingPages) {
    AutoUserEntryPlugin::log('User already exists and has a page belonging to them; aborting.', LogLevel::Info);
    throw new Exception(Craft::t("You already have an account and a page created for you. Aborting. You have not been charged."));
} else {
    AutoUserEntryPlugin::log('User with ID ' . $existingUser-&gt;id . ' does not seem to have a page.', LogLevel::Info);
}


But with a user I know for a fact has an Entry for which they are the author, it's returning "User with ID 1198 does not seem to have a page".
Getting entries in plugins is slightly different from within templates and you should read the details on Working with Elements in a plugin in the Craft docs.

Taking that as a guide, you need to create an ElementCriteriaModel instance which selects the entries you are interested in:

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;authorId = 10;


Note that the ElementCriteriaModel won't pull disabled entries by default. If you want to pull both enabled and disabled entries, you can add the status parameter to your query:

$criteria-&gt;status = null;


Finally, you need to call find() on the ElementCriteriaModel to fetch the entries matching your criteria:

$entries = $criteria-&gt;find();