Page 1 of 1

Names in a comment

Posted: Fri Jan 05, 2007 9:53 pm
by Davy
Hey!

I want to make a construction so that the name of a user is replaced by something else.

For example: If I fill in "Peter" it should be replaced with "Davy".

I think that this is possible using PHP, like this:

Code: Select all

if ($name = Peter) {
$name = Davy;
}
But where to place this code, and what parameters to use?

Re: Names in a comment

Posted: Sat Jan 06, 2007 12:53 pm
by garvinhicking
Hi!

Where to you want to replace that name? Inside the body of your entries?

If you want to rename an author, why don't you rename him in the usermanagement screen? :-)

Best regards,
Garvin

Posted: Sat Jan 06, 2007 1:03 pm
by Davy
No... I know how to do that, but I want to replace the name that a user fills in when posting a comment. In that proces the script should check the name-field and replace it if needed.

Posted: Sat Jan 06, 2007 1:06 pm
by garvinhicking
Hi!

Can I ask why you want to replace a name that a user himself can enter?!?

You can change that in the comments.tpl file of your theme, using smarty syntax:

Code: Select all

{if $comment.author == 'Peter'}
  Garvin
{else}
  {$comment.author|@default:$CONST.ANONYMOUS}
{/if}
HTH,
Garvin

Posted: Sat Jan 06, 2007 1:10 pm
by Davy
Thanks for that fast answer!

I wanted this because my site is going to be a very strange one, with some strange menus, and also this little joke. :)