Redirect after login to specific page
In Edit Profile link append destination parameter like: 

if(user_is_anonymous()){    
  $editlink = l(t('Edit Profile'), 'user/login', array('query' =&gt; array('destination' =&gt; 'user/UID/edit')));
}


Then after login, it will redirect to profile edit page.