acs_user::create_portrait (public)
acs_user::create_portrait -user_id user_id \ [ -description description ] [ -filename filename ] \ [ -mime_type mime_type ] -file file
Defined in packages/acs-tcl/tcl/community-core-procs.tcl
Sets (or resets) the portraif for current user to the one specified.
- Switches:
- -user_id (required)
- user_id of user whose portrait we want to set.
- -description (optional)
- A caption for the portrait.
- -filename (optional)
- Original filename of the portrait. Used to guess the mimetype if an explicit one is not specified.
- -mime_type (optional)
- mimetype of the portrait. If missing, filename will be used to guess one.
- -file (required)
- Actual file containing the portrait
- Returns:
- item_id of the new content item
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_admin_merge_MergeUserInfo, auth_authenticate, demote_promote_a_user
Source code: # Delete old portrait, if any acs_user::erase_portrait -user_id $user_id if {$mime_type eq ""} { # This simple check will suffice here. CR has its own means to # ensure a valid mimetype set mime_type [ns_guesstype $filename] } # Create the new portrait set item_id [content::item::new -name "portrait-of-user-$user_id" -parent_id $user_id -content_type image -storage_type file -creation_user [ad_conn user_id] -creation_ip [ad_conn peeraddr] -description $description -tmp_filename $file -is_live t -mime_type $mime_type] # Create portrait relationship db_exec_plsql create_rel {} return $item_idGeneric XQL file: packages/acs-tcl/tcl/community-core-procs.xql
PostgreSQL XQL file: <fullquery name="acs_user::create_portrait.create_rel"> <querytext> select acs_rel__new ( null, 'user_portrait_rel', :user_id, :item_id, null, null, null ) </querytext> </fullquery>packages/acs-tcl/tcl/community-core-procs-postgresql.xql
Oracle XQL file: <fullquery name="acs_user::create_portrait.create_rel"> <querytext> begin :1 := acs_rel.new ( rel_type => 'user_portrait_rel', object_id_one => :user_id, object_id_two => :item_id); end; </querytext> </fullquery>packages/acs-tcl/tcl/community-core-procs-oracle.xql