数字化技能提升教程,数字化时代生存宝典

数字化百科 / 产品文档 / Gallery:如何将评论中的全名修改为用户名

Gallery:如何将评论中的全名修改为用户名

查看全部产品文档命名空间:Gallery

或许你不想在G2相关的评论中留下全名,而只想显示用户名。不过模块不能提供这种便利,所以我得对文件做些调整。


gallery2/modules/comment/templates/Comment.tpl文件中
来看最后几行



{capture name="date"}{g->date timestamp=$comment.date style="datetime"}{/capture}
{if $can.edit}
{g->text text="Posted by %s on %s (%s)"
arg1=$user.fullName|default:$user.userName
arg2=$smarty.capture.date
arg3=$comment.host}

{else}
{g->text text="Posted by %s on %s"
arg1=$user.fullName|default:$user.userName
arg2=$smarty.capture.date}
{/if}



我将$user.fullName修改为$user.userName。但不知道"default:"后的第二部分是做什么用的。

另外,如果你想将项目所有者的全名修改为用户名的话,在gallery2/modules/core/templates/blocks/ItemInfo.tpl文件中


{if !empty($showOwner)}

{g->text text="Owner: %s" arg1=$item.owner.fullName|default:$item.owner.userName}

{/if}

将$item.owner.fullName修改为$item.owner.userName

更多相关信息可在此论坛帖子中找到