ctools_modal_render() in a condition
You can use below code to redirect anonymous user to user login page.

if ($js) {
  // Required includes for ctools to work:
  ctools_include('modal');
  ctools_include('ajax');
}

if (user_is_logged_in()) {
  $title = 'hello';
  $output = 'more hellos';
  ctools_modal_render($title, $output);
} else {

  ctools_ajax_command_redirect('user/login');
  ctools_modal_command_dismiss();

}


Or, If you do not want to display popup to anonymous user, then you need to check user is anonymous or not before redering the ctools popup link.

&lt;?php if (user_is_logged_in()): ?&gt;
&lt;a href="your_link" class="ctools-use-modal ctools-modal-[yourpopupclass]"&gt;Link 1&lt;/a&gt;
&lt;?php else: ?&gt;
&lt;a href="user/login"&gt;Login&lt;/a&gt;
&lt;?php endif; ?&gt;