How to have FancyBox Dialog if action redirect for signing in

I have a CGridView listing resources, which can be accessed by selecting the hyper-linked cell of a row (‘Enrol’ in the image attached below). Since the corresponding action is allowed for ‘@’ users, the logged-in users get the view immediately, and the guest users is redirected to the login page. So far so good (this is how things are done in Yii, right?).



Since my resource view is very low on content and the user must return to the starting view, I decided to pop-it-up using fancybox. The pop-up works only if the user is logged in. Otherwise, the pop-up comes up with the message - "The requested content cannot be loaded…".

The code for the CGridView column is -


	'type'=> 'raw',

	'value' => 'CHtml::link("Enrol", "javascript: jsEnrol($data->id)")',

	'htmlOptions' => array('style' => 'text-align:center'),

	'visible' => $allowEnrol,)

The corresponding javascript action is -


function jsEnrol(id){

	var cHref = $('a#fb_enrol').attr("href");

	$('a#fb_enrol').attr("href", cHref + "/create/cid/" + id);//append the ID of the row before invoking the pop-up


	$('a#fb_enrol').attr("href", cHref);//reset the link-href so that the subsequent actions do not keep adding up	




echo CHtml::link("Am I hidden",


	array('title'=>'Enrol for the Tournament',





	array('target'=> '#fb_enrol',

		'config'=>array('scrolling' => 'no',

			  'titleShow' => true,




Do you have a way where the login view appears first and, on success returns to grid view with the intended pop-up? For the sake of consistency across the application, I may not want the login itself to appear as a pop-up.