Jump to content
Larry Ullman's Book Forums

Chtml::Submitbutton Visibility


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...