在成功登录后显示注销按钮以及用户名称 [英] show logout button along with the name of user after successfull login

查看:218
本文介绍了在成功登录后显示注销按钮以及用户名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个可爱的人,我被困在一个点上。我在我的项目中有三个角色。 1.Admin。 2.Owner 3.经过验证的用户。我有一个页眉和一个页脚小部件。页眉小部件是顶部有一个注册和登录链接。我想在成功登录后显示我的用户名和注销链接。我不想制作另一个小部件。我知道逻辑,我们可以使用,如果其他人。
如果用户已经登录,在顶部(头部小部件)显示他的名字和注销链接。否则,如果他是普通用户或未登录显示他,注册和登录链接。这就是它。但如何编写代码..是我不知道的事情。另外我还使用yii权限和yii用户扩展程序。
请阅读文档。

这会有帮助:

http://www.yiiframework.com/doc/api/1.1/CWebUser#isGuest-detail



这里的例子: http://pastebin.com/r0XpkPNZ


I am a yiibie, and i am stuck at a point. I have three roles in my project. 1.Admin. 2.Owner 3. Authenticated User. I have a header and a footer widget.In header widget which is the top section has a signup and login link. i want to show my user name and a logout link after his successful login. I do not want to make another widget. i Know the logic, we can use if else. If a user has been logged in, show his name and logout link at the top section(header widget). else if he is a normal user or not logged in show him, signup and login link. Thats it.But how to write code..is the thing i dont know. Plus i am using yii rights and yii user extension too.

解决方案

Read the documentation please.

This will be helpful:

http://www.yiiframework.com/doc/api/1.1/CWebUser#isGuest-detail

Here example: http://pastebin.com/r0XpkPNZ

这篇关于在成功登录后显示注销按钮以及用户名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆