Home
The Toolkit for Online Communities
15936 Community Members, 1 member online, 2287 visitors today
Log In Register

Forum .LRN Q&A: Chat with usernames

OpenACS Home : Forums : .LRN Q&A : Chat with usernames

Icon of Envelope Request notifications

+
Posted by Matthew Coupe on
Hi there,

Is it possible to change the AJAX chat to use the username instead of the Screen Name in it's display. We have changed the Screen Name on our system to be an ID number and would rather not use this in the chat.

Thanks for any help!
Matthew

+
2: Re: Chat with usernames (response to 1)
Posted by Gustaf Neumann on
yes, of course it is possible. but no, there is no parameter.

Edit chat/tcl/chat-ajax-procs.tcl and add there after the definition of the class Chat the following method:

  Chat instproc user_name { user_id } {
acs_user::get -user_id $user_id -array user
return $user(name)
}

...or return some other formatting in this method...

Background: The Chat class in chat-ajax-procs is a subclass of ::xo::Chat defined in xotcl-core, where the default behavior is defined. The default behavior can be changed in the subclass by overwriting the method without affecting the behavior of other subclasses. The default behavior is defined in xotcl-core as:

  Chat instproc user_name { user_id } {
acs_user::get -user_id $user_id -array user
return [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}]
}

by defining an object specific method, it would be possible without much work to provide a different behavior per chat instance - which is certainly not needed in your case.