edu_random_member_blurb db class_idWhat it does:
Returns a random class member's photograph and a little bioDefined in: /web/philip/tcl/education.tcl
Source code:
set users_with_photos_list [database_to_tcl_list $db "select u.user_id from users_active u, user_group_map ugm where u.user_id=ugm.user_id and ugm.group_id=$class_id and u.portrait is not null"] # and u.user_id != [ad_get_user_id]"] if { [llength $users_with_photos_list] == 0 } { return "" } # get the lucky user set random_num [randomRange [expr [llength $users_with_photos_list] -1] ] set portrait_user_id [lindex $users_with_photos_list $random_num] set selection [ns_db 0or1row $db " select u.first_names || ' ' || u.last_name as name, ugm.role, pretty_role from users u, user_group_map ugm, edu_role_pretty_role_map m where u.user_id = ugm.user_id and u.user_id = $portrait_user_id and ugm.group_id = $class_id and m.group_id=$class_id and m.role=ugm.role and rownum < 2"] if { [empty_string_p $selection] } { return "" } set_variables_after_query # **** this should really be smart and look for the actual thumbnail # but it isn't and just has the browser smash it down to a fixed width set string_to_return " <a href=\"/shared/portrait?user_id=$portrait_user_id\"><img width=125 src=\"/shared/portrait-bits?user_id=$portrait_user_id\"></a> <p> <a href=/shared/community-member?user_id=$portrait_user_id>$name</a>,<br>$pretty_role " return $string_to_return