forum::message::new (public)
forum::message::new -forum_id forum_id [ -message_id message_id ] \ [ -parent_id parent_id ] -subject subject -content content \ [ -format format ] [ -user_id user_id ] [ -no_callback ]
Defined in packages/forums/tcl/messages-procs.tcl
Create a new message.
- Switches:
- -forum_id (required)
- -message_id (optional)
- -parent_id (optional)
- -subject (required)
- -content (required)
- -format (optional, defaults to
"text/plain"
)- -user_id (optional)
- -no_callback (optional, boolean)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- forum_message_new, forum_count_test, web_forums_message_and_reply
Source code: # If no user_id is provided, we set it # to the currently logged-in user if {$user_id eq ""} { set user_id [ad_conn user_id] } set original_message_id $message_id db_transaction { set var_list [list [list forum_id $forum_id] [list message_id $message_id] [list parent_id $parent_id] [list subject $subject] [list content $content] [list format $format] [list user_id $user_id]] set message_id [package_instantiate_object -var_list $var_list forums_message] forum::message::do_notifications -message_id $message_id -user_id $user_id } on_error { db_abort_transaction # Check to see if the message with a message_id matching the # message_id argument was in the database before calling # this procedure. If so, the error is due to a double click # and we should continue without returning an error. if {$original_message_id ne ""} { # The was a non-null message_id argument if {[db_string message_exists_p {}]} { return $message_id } else { # OK - it wasn't a simple double-click, so bomb ad_return_error "OACS Internal Error" "Error in forum::message::new - $errmsg" ad_script_abort } } } forum::flush_cache -forum_id $forum_id return $message_idXQL Not present: PostgreSQL, Oracle Generic XQL file: <fullquery name="forum::message::new.message_exists_p"> <querytext> select count(message_id) from forums_messages where message_id = :message_id </querytext> </fullquery>packages/forums/tcl/messages-procs.xql