Flag the node after login
You can try using hook_node_view for doing this.
What it does is:


  Act on a node that is being assembled before rendering.


Here is an idea to try out:

/**
 * Implements hook_node_view
 */
function yourmodule_node_view ($node, $view_mode, $langcode) {

  // use a one-timer boolean for this action
  if(user_is_logged_in() &amp;&amp; !isset($_SESSION['autoflagging_once']))
  {
    $_SESSION['autoflagging_once'] = true; 
    $flag = flag_get_flag('wishlist');
    $flag-&gt;flag('flag', $node-&gt;nid, user_load($uid), TRUE);
  }

}


Good luck!