Page 1 of 1
adding a link
Posted:
13 Jul 2014, 18:02
by zoom2
Hi,
I want to add" Login" and "Signup" link button in the main page. I tried this , but both links are coming in separate 2 lines. Refer attachment.
I wanted it be part of "User-panel" menu item.
I have edited code "protected/views/layout/main.php( refer attachment for code change)
Please guide me.
Re: adding a link
Posted:
14 Jul 2014, 12:28
by zoom2
Hello,
Could you please help me in resolving the above issue.
It will be of great help.
Regards
Alva
Re: adding a link
Posted:
20 Jul 2014, 08:36
by zoom2
Hi,
Any help I can get on the above request from experts.
Thank you
Alva
Re: adding a link
Posted:
21 Jul 2014, 06:51
by Koduc
Edit file /protected/components/Controller.php
Insert following code:
- Code: Select all
array('label' => '|', 'visible' => Yii::app()->user->getState('isAdmin') === null),
array(
'label' => tc('Login'),
'url' => array('/site/login'),
'visible' => Yii::app()->user->getState('isAdmin') === null,
),
array('label' => '|', 'visible' => Yii::app()->user->getState('isAdmin') === null),
array(
'label' => tc('Register'),
'url' => array('/site/register'),
'visible' => Yii::app()->user->getState('isAdmin') === null,
),
after:
- Code: Select all
array(
'label' => Yii::t('common', 'Control panel'),
'url' => array('/usercpanel/main/index'),
'visible' => Yii::app()->user->getState('isAdmin') === null,
'items' => $subItems,
'submenuOptions'=>array(
'class'=>'sub_menu_dropdown'
),
),
Re: adding a link
Posted:
21 Jul 2014, 18:17
by zoom2
Dear Team,
Thank you for your continuous support.
After going through the forum, I observed that your team is providing great support to all users.
Keep up the good work!
Regards
Alva
Re: adding a link
Posted:
15 Nov 2014, 16:52
by zoom2
Hi,
I added extra "login" and "register" link in the home page as mentioned above. But it will be visible after the user login also. I want to hide once user logs in.
You mentioned to add following additional code "'visible' => !Yii::app()->user->isGuest,"
But not sure where to include I did like below, but did not work:
array(
'label' => tc('Login'),
'url' => array('/site/login'),
'visible' => !Yii::app()->user->isGuest,
'visible' => Yii::app()->user->getState('isAdmin') === null,
Re: adding a link
Posted:
18 Nov 2014, 10:36
by andipas
- Code: Select all
array(
'label' => tc('Login'),
'url' => array('/site/login'),
'visible' => !Yii::app()->user->isGuest,
without 'visible' => Yii::app()->user->getState('isAdmin') === null,
Re: adding a link
Posted:
25 Nov 2014, 20:03
by zoom2
Hi,
As explained above I have added " 'visible' => !Yii::app()->user->isGuest," and commented "'visible' => Yii::app()->user->getState('isAdmin') === null,"
as shown below.
array(
'label' => tc('Login'),
'url' => array('/site/login'),
'visible' => !Yii::app()->user->isGuest,
// 'visible' => Yii::app()->user->getState('isAdmin') === null,
The result is :
1. Login link disappeared for guest and register link was available.
2. Also I observed after loging in still "login" and "register" link was available.
I required earlier to only display "login "and "register" link for guest and once user logs in then both link should not be available.
Please suggest solution.
Regards
Raj
Re: adding a link
Posted:
02 Dec 2014, 13:50
by Foton
Try to use
- Code: Select all
'visible' => Yii::app()->user->isGuest
for both link