I create a user from a form (that part works fine) but no profile2 information seems to be created....
profile2_load_by_user returns an empty array which results in the below error. Do I need to some other step to first associate an "ae_sa" profile with the newly created user?
Recoverable fatal error: Argument 1 passed to profile2_save() must be an instance of >ProfileProfile, instance of stdClass given, called in D:\FULLREPO\trunk\sites\all\modules\sps_users\sps_users.module on line 115 and defined in >profile2_saveprofile2_save() (line 291 of D:\FULLREPO\trunk\sites\all\modules\profile2\profile2.module).
...
$account = user_save(null, $new_user);
$obj_user = user_load($account->uid) ;
$profile2 = profile2_load_by_user($obj_user) ;
$profile2["ae_sa"]->field_full_name[LANGUAGE_NONE][0]["value"] = $fullname;
$profile2["ae_sa"]->field_title_role[LANGUAGE_NONE][0]["value"] = $titlerole;
$profile2["ae_sa"]->field_company[LANGUAGE_NONE][0]["value"] = $ucompany;
$profile2["ae_sa"]->field_bio[LANGUAGE_NONE][0]["value"] = $bio;
profile2_save($profile2["ae_sa"]) ;