I am using the Import plugin. This question doesn't have to do with the Import plugin which seems to be working swell, but instead with my onBeforeSaveEntry
logic which seems to have botched the import process.
public function init()
{
parent::init();
craft()->on('entries.onBeforeSaveEntry', function(Event $event)
{
if($params['isNewEntry']) {
$entry = $event->params['entry'];
$criteria = craft()->elements->getCriteria(ElementType::User);
$criteria->groupId = 1;
$criteria->AffiliateId = $entry['AffiliateId'];
$criteria->limit = 1;
$users = $criteria->find();
if (!empty($users)) {
$assignedCoach = $users[0]->id;
$entry->authorId = $assignedCoach;
$entry->getContent()->coachId = $assignedCoach;
}
}
});
}
What am I doing wrong here? Also, any idea how I kill the import processes which seem to be hung at the moment?