Hello. i have comment form here.
<div class="comment_form">
<p class="comment_title">Leave comment</p>
<?php echo CHtml::beginForm()?>
<div class="comment" id="a">
<?php echo CHtml::textArea('content', '', array('id'=>'comment_area', 'rows'=>6, 'cols'=>38))?>
</div>
<div class="comment" id="b">
<br />
<?php echo CHtml::ajaxSubmitButton('Submit',
array('comment/add'),
array(
'type'=>'post',
'beforeSend'=>'js:function(){
if($(".comment_form textarea").val()=="")
{
$(".comment_form textarea").css("border","1px solid #f00");
return false;
}
else
{
return true;
}
}',
'data'=>array(
'content'=>'js:$(".comment_form textarea").val()',
'owner'=> Yii::app()->user->getID(),
'post'=>$model->id,
),
'success'=>'js:function (){
$(".comment_form textarea").css("border","1px solid #cacaca");
$(".comment_form textarea").val("");
alert("Done");
}'
),
array(
'id'=>'leave',
)
);?>
</div>
<?php echo CHtml::endForm();?>
</div>
It send ajax request to leave comment. But i don’t know how to deny non-logged in user lo leave comment. How i do this? And sorry about my english of there is mistake.