typecho皮肤中的author.php就是用户的个人中心,那么如何用它实现用户在前台修改个人信息呢?
直接用如下代码即可:
<section>
<h3><?php _e('个人资料'); ?></h3>
<ul><li>
<label class="typecho-label" for="screenName-0-1">
用户名</label><?php $this->user->name() ?></li></ul>
<?php Typecho_Widget::widget('Widget_Users_Profile')->profileForm()->render(); ?>
</sction>
<section id="change-password">
<h3><?php _e('密码修改'); ?></h3>
<?php Typecho_Widget::widget('Widget_Users_Profile')->passwordForm()->render(); ?>
</sction>
<?php Typecho_Widget::widget('Widget_Users_Profile')->personalFormList(); ?>直接用的话,需要考虑一些事情,比如游客访问进来如果也这样显示岂不是很尴尬,A用户访问B用户时显示也会变尴尬,所以需要加入判断。
<?php if($this->user->uid==$this->author->uid && $this->user->hasLogin()): ?>
这里填写上边的代码即可
<?php endif; ?>代码说明:如果处于登录状态,用户的id等于当前作者的id就显示。