Index: openacs-4/packages/acs-subsite/www/user/portrait/erase.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/user/portrait/erase.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/acs-subsite/www/user/portrait/erase.tcl 7 Aug 2017 23:47:59 -0000 1.10 +++ openacs-4/packages/acs-subsite/www/user/portrait/erase.tcl 16 Aug 2017 09:18:20 -0000 1.11 @@ -41,39 +41,11 @@ ad_form -name "portrait_erase" -export {user_id return_url} -form {} -on_submit { - set item_id [db_string get_item_id {} -default ""] - - if {$item_id eq ""} { - ad_returnredirect $return_url - ad_script_abort - } - - set resized_item_id [image::get_resized_item_id -item_id $item_id] - - # Delete the resized version - if {$resized_item_id ne ""} { - content::item::delete -item_id $resized_item_id - } - - # Delete all previous images - db_foreach get_images {} { - package_exec_plsql -var_list [list [list delete__object_id $object_id]] acs_object delete - } - - db_foreach old_item_id {} { - content::item::delete -item_id $object_id - } - - # Delete the relationship - db_dml delete_rel {} - - # Delete the item - content::item::delete -item_id $item_id - - # Flush the portrait cache - util_memoize_flush [list acs_user::get_portrait_id_not_cached -user_id $user_id] - + acs_user::erase_portrait -user_id $user_id + ad_returnredirect $return_url + ad_script_abort + } ad_return_template Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/acs-subsite/www/user/portrait/erase.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl,v diff -u -r1.63 -r1.64 --- openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl 7 Aug 2017 23:47:59 -0000 1.63 +++ openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl 16 Aug 2017 09:18:20 -0000 1.64 @@ -325,6 +325,10 @@ change_state -user_id $user_id -state "deleted" acs_user::flush_cache -user_id $user_id } else { + # portrait is also an entry in acs_objects with creation_user + # set to this user. Therefore won't be deleted by cascade and + # must be removed manually + acs_user::erase_portrait -user_id $user_id db_exec_plsql permanent_delete {} } } @@ -733,6 +737,25 @@ return [db_string get_item_id "" -default 0] } +ad_proc -private acs_user::erase_portrait { + {-user_id:required} +} { + Erases portrait of a user + + @param user_id user_id of user whose portrait we want to delete +} { + set item_id [acs_user::get_portrait_id \ + -user_id $user_id] + + if {$item_id != 0} { + # Delete the item + content::item::delete -item_id $item_id + + # Flush the portrait cache + util_memoize_flush [list acs_user::get_portrait_id_not_cached -user_id $user_id] + } +} + # Local variables: # mode: tcl # tcl-indent-level: 4