Gallery2:How to Change Fullname to Username in Comments - Gallery Codex
Personal tools

Gallery2:How to Change Fullname to Username in Comments

From Gallery Codex

Maybe you don't want to show full names associated with the comments in G2, but show usernames instead. Unfortunately the module doesn't allow the ability to choose yet, so I had to hack the files.

In the file gallery2/modules/comment/templates/Comment.tpl go to the last few lines

<p class="info">
  {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}
</p>

I changed $user.fullName to $user.userName. Dunno what the second portion after "default:" is for.

Additionally, if you want to change the item owner's fullname to username, in gallery2/modules/core/templates/blocks/ItemInfo.tpl

{if !empty($showOwner)}
  <span class="owner summary">
    {g->text text="Owner: %s" arg1=$item.owner.fullName|default:$item.owner.userName}
  </span>
  {/if}

Change $item.owner.fullName to $item.owner.userName


More info in this forum thread

advertisements