Jump to content
Larry Ullman's Book Forums

Chtml::Submitbutton Visibility


nkhanna24
 Share

Recommended Posts

hi all
I am having this difficulty with this button 
<div class="row buttons">
<?= CHtml::submitButton('Submit to all', array('class' => 'button-send-v2', 'value' => '','name'=>'all')); ?>
<span class="go-back">
<span class="gray-text"> or </span>
<?= CHtml::link('Cancel', $this->createAbsoluteUrl('forum/index'), array('class' => 'go-back')); ?>
</span>
</div>

how do i hide this button depending on the user id(Yii::app()->user->id) or at admin login?

Link to comment
Share on other sites

Well it depends on what the id of admin is, if admin had an id of 1 then something like this

 

<div class="row buttons">

<?php

if (Yii::app()->user->id !== 1)

{

    // Render the button if admin is not logged in with user id 1

    CHtml::submitButton('Submit to all', array('class' => 'button-send-v2', 'value' => '','name'=>'all'));

}

?>

<span class="go-back">
<span class="gray-text"> or </span>
<?= CHtml::link('Cancel', $this->createAbsoluteUrl('forum/index'), array('class' => 'go-back')); ?>
</span>
</div>

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...