Names in a comment

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Names in a comment

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Names in a comment

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Davy
Regular
Posts: 109
Joined: Fri Oct 13, 2006 2:06 pm
Location: The Netherlands

Post 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. :)
Post Reply