Index: openacs-4/packages/forums/lib/forums/forums-history-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/forums/forums-history-chunk.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/forums/lib/forums/forums-history-chunk.tcl 22 May 2018 15:59:27 -0000 1.10 +++ openacs-4/packages/forums/lib/forums/forums-history-chunk.tcl 25 Jun 2018 09:15:00 -0000 1.11 @@ -15,8 +15,11 @@ set table_bgcolor [parameter::get -parameter table_bgcolor] set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] +set visitor_name [_ acs-kernel.Unregistered_Visitor] # provide screen_name functionality -set screen_name [acs_user::get_element -user_id $user_id -element screen_name] +set screen_name [expr {$user_id > 0 ? + [acs_user::get_element -user_id $user_id -element screen_name] : + $visitor_name}] set useScreenNameP [parameter::get -parameter "UseScreenNameP" -default 0] template::list::create \ @@ -29,7 +32,16 @@ name { label "\#forums.User\#" html {align left} - display_template {@screen_name@@persons.first_names@ @persons.last_name@} + display_template { + + @screen_name@ + + + + @persons.user_name@ + + + } } num_msg { label "\#forums.Number_of_Posts\#" @@ -42,8 +54,8 @@ } db_multirow -extend { - first_names - last_name + user_name + user_url } persons select_users_wrote_post { select user_id, count(*) as num_msg, @@ -52,9 +64,13 @@ where forum_id = :forum_id group by user_id } { - acs_user::get -user_id $user_id -array user - set first_names $user(first_names) - set last_name $user(last_name) + if {$user_id > 0} { + set user_name [acs_user::get_element -user_id $user_id -element name] + set user_url user-history?user_id=$user_id + } else { + set user_name $visitor_name + set user_url "#" + } } if {[info exists alt_template] && $alt_template ne ""} { Index: openacs-4/packages/forums/lib/message/post.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/post.tcl,v diff -u -r1.27 -r1.28 --- openacs-4/packages/forums/lib/message/post.tcl 11 Jun 2018 14:04:10 -0000 1.27 +++ openacs-4/packages/forums/lib/message/post.tcl 25 Jun 2018 09:15:00 -0000 1.28 @@ -9,7 +9,12 @@ } set user_id [ad_conn user_id] -acs_user::get -user_id $user_id -array user +if {$user_id > 0} { + acs_user::get -user_id $user_id -array user +} else { + set user(screen_name) [_ acs-kernel.Unregistered_Visitor] + set user(name) $user(screen_name) +} set screen_name $user(screen_name) set useScreenNameP [parameter::get -parameter "UseScreenNameP" -default 0] @@ -170,7 +175,7 @@ if {$action eq "post"} { set content [template::util::richtext::get_property content $message_body] set format [template::util::richtext::get_property format $message_body] - + forum::message::new \ -forum_id $forum_id \ -message_id $message_id \ Index: openacs-4/packages/forums/lib/message/row.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/row.adp,v diff -u -r1.25 -r1.26 --- openacs-4/packages/forums/lib/message/row.adp 15 Jun 2018 20:50:33 -0000 1.25 +++ openacs-4/packages/forums/lib/message/row.adp 25 Jun 2018 09:15:00 -0000 1.26 @@ -27,9 +27,10 @@ @message.user_name@ - + + @message.user_name@ - + #forums.on# @message.posting_date_pretty@ Index: openacs-4/packages/forums/lib/message/row.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/row.tcl,v diff -u -r1.15 -r1.16 --- openacs-4/packages/forums/lib/message/row.tcl 15 Jun 2018 20:50:33 -0000 1.15 +++ openacs-4/packages/forums/lib/message/row.tcl 25 Jun 2018 09:15:00 -0000 1.16 @@ -23,9 +23,15 @@ set message(content) [ad_html_text_convert -from $message(format) -to text/html -- $message(content)] -set message(user_name) [acs_user::get_element \ - -user_id $message(user_id) \ - -element [expr {$useScreenNameP ? "screen_name" : "name"}]] +if {$message(user_id) > 0} { + set message(user_name) [acs_user::get_element \ + -user_id $message(user_id) \ + -element [expr {$useScreenNameP ? "screen_name" : "name"}]] + set message(user_url) user-history?user_id=$message(user_id) +} else { + set message(user_name) [_ acs-kernel.Unregistered_Visitor] + set message(user_url) "" +} # convert emoticons to images if the parameter is set if { [string is true [parameter::get -parameter DisplayEmoticonsAsImagesP -default 0]] } { Index: openacs-4/packages/forums/lib/message/threads-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/threads-chunk.tcl,v diff -u -r1.29 -r1.30 --- openacs-4/packages/forums/lib/message/threads-chunk.tcl 11 Jun 2018 14:31:24 -0000 1.29 +++ openacs-4/packages/forums/lib/message/threads-chunk.tcl 25 Jun 2018 09:15:00 -0000 1.30 @@ -146,6 +146,8 @@ set useScreenNameP [parameter::get -parameter "UseScreenNameP" -default 0] +set visitor_name [_ acs-kernel.Unregistered_Visitor] + db_multirow -extend { user_name screen_name @@ -156,9 +158,16 @@ n_messages_pretty state_pretty } messages messages_select {} { - set user [acs_user::get -user_id $user_id] - set screen_name [dict get $user screen_name] - set user_name [dict get $user name] + if {$user_id > 0} { + set user [acs_user::get -user_id $user_id] + set screen_name [dict get $user screen_name] + set user_name [dict get $user name] + set user_url [export_vars -base "${base_url}user-history" { user_id }] + } else { + set screen_name $visitor_name + set user_name $visitor_name + set user_url "" + } set last_child_post_ansi [lc_time_system_to_conn $last_child_post_ansi] set last_child_post_pretty [lc_time_fmt $last_child_post_ansi "%x %X"] @@ -170,10 +179,6 @@ if { $useScreenNameP } { set user_name $screen_name set user_url "" - } elseif {$user_id eq ""} { - set user_url "" - } else { - set user_url [export_vars -base "${base_url}user-history" { user_id }] } set n_messages_pretty [lc_numeric $n_messages] Index: openacs-4/packages/forums/tcl/messages-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/messages-procs.tcl,v diff -u -r1.52 -r1.53 --- openacs-4/packages/forums/tcl/messages-procs.tcl 15 Jun 2018 16:46:17 -0000 1.52 +++ openacs-4/packages/forums/tcl/messages-procs.tcl 25 Jun 2018 09:15:00 -0000 1.53 @@ -229,10 +229,16 @@ array unset row } } else { - set user [acs_user::get -user_id $row(user_id)] - set row(user_name) [dict get $user name] - set row(user_email) [dict get $user email] - set row(screen_name) [dict get $user screen_name] + if {$row(user_id) > 0} { + set user [acs_user::get -user_id $row(user_id)] + set row(user_name) [dict get $user name] + set row(user_email) [dict get $user email] + set row(screen_name) [dict get $user screen_name] + } else { + set row(user_name) [_ acs-kernel.Unregistered_Visitor] + set row(user_email) "" + set row(screen_name) $row(user_name) + } forum::get -forum_id $row(forum_id) -array forum set row(forum_name) $forum(name)