Activation Email for Pending User Doesn't Work User account is "pending"
verificationCode is created in database, and erases when visiting the hyperlink.
I'm able to successfully produce an activation email using the code below:


Code:    

$user = craft()-&gt;users-&gt;getUserByEmail($emailAddress);

if ($user-&gt;getStatus() != "active")
{
    craft()-&gt;users-&gt;sendActivationEmail($user);



I'm redirected to the page set for activateAccountSuccessPath in config/general.php which an account edit page.
I'm "sort of" half logged in... able to see the email address for my account filled in the edit profile form, but the CMS otherwise does not recognize me as logged in.


Any ideas?
After following the stack trace for activating a user (with the link), I discovered that activation fails at /craft/app/services/UsersService.php:822:

820:   public function verifyEmailForUser(UserModel $user)
821:   {
822:      if ($user-&gt;unverifiedEmail)
823:      {


Apparently I needed to set the unverifiedEmail property when creating "Pending" users via a plugin as opposed to only setting the 'pending' property to false.

$user = new UserModel();
$user-&gt;email = 'pendinguser@email.com;
// ... set other properties
$user-&gt;pending = false;
$user-&gt;unverifiedEmail = '';