forum::message::notify_users (private)

 forum::message::notify_users -message_array message_array \
    -forum_url forum_url -message_url message_url

Defined in packages/forums/tcl/messages-procs.tcl

Notify users of a new approved forum message.

Switches:
-message_array (required)
name of message array of forum info in the caller scope
-forum_url (required)
-message_url (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_forum_count_test forum_count_test (test forums) forum::message::notify_users forum::message::notify_users test_forum_count_test->forum::message::notify_users test_forum_message_new forum_message_new (test forums) test_forum_message_new->forum::message::notify_users ad_html_text_convert ad_html_text_convert (public) forum::message::notify_users->ad_html_text_convert attachments::get_attachments attachments::get_attachments (public) forum::message::notify_users->attachments::get_attachments notification::new notification::new (public) forum::message::notify_users->notification::new notification::type::get_type_id notification::type::get_type_id (public) forum::message::notify_users->notification::type::get_type_id parameter::get parameter::get (public) forum::message::notify_users->parameter::get forum::message::do_notifications forum::message::do_notifications (public) forum::message::do_notifications->forum::message::notify_users

Testcases:
forum_message_new, forum_count_test
Source code:
    upvar 1 $message_array message

    set useScreenNameP [parameter::get -parameter "UseScreenNameP" -default 0]

    set attachments [attachments::get_attachments -object_id $message(message_id)]

    set message_text [ad_html_text_convert -from $message(format) -to text/plain -- $message(content)]
    set message_html [ad_html_text_convert -from $message(format) -to text/html -- $message(content)]

    set SecureOutboundP [parameter::get -parameter "SecureOutboundP" -default 0]
    if { $SecureOutboundP && [ns_conn isconnected] && [security::secure_conn_p] } {
        set href [ns_quotehtml $message_url]
        set message_html "<p>#forums.Message_content_withheld# #forums.To_view_message_follow_link# <a href=\"$href\">$href</a></p>"
        set message_text [ad_html_text_convert -from text/html -to text/plain -- $message_html]
    } else {
        #
        # The resulting HTML messages is sent in total by
        # notifications::send through [lang::util::localize...].  In case
        # a forums message contains something looking like a localized
        # message key, it will be substituted. One rough attempt is to add
        # a zero width space after the "#" signs to make the regular
        # expression searching for the message keys fail....
        #
        regsub -all -- "#" $message_html "#\\&#8203;" message_html
    }

    set html_version ""
    append html_version "#forums.Forum#:  <a href=\"$forum_url\">$message(forum_name)</a><br>\n"
    append html_version "#forums.Thread#: <a href=\"$message_url\">$message(root_subject)</a><br>\n"
    if {$useScreenNameP == 0} {
        append html_version "#forums.Author#: <a href=\"mailto:$message(user_email)\">$message(user_name)</a><br>\n"
    } else {
        append html_version "#forums.Author#: $message(screen_name)<br>\n"
    }
    append html_version "#forums.Posted#: $message(posting_date)<br>"
    append html_version "\n<br>\n"

    append html_version $message_html
    append html_version "<p>   "

    if {[llength $attachments] > 0} {
        append html_version "#forums.Attachments#:
                            <ul> "

        foreach attachment $attachments {
            append html_version "<li><a href=\"[lindex $attachment 2]\">[lindex $attachment 1]</a></li>"
        }
        append html_version "</ul>"
    }

    set html_version $html_version

    set text_version ""
    append text_version "
#forums.Forum#: $message(forum_name)
#forums.Thread#: $message(root_subject)\n"
    if {$useScreenNameP == 0} {
        append text_version "#forums.Author#: $message(user_name)"
    } else {
        append text_version "#forums.Author#: $message(screen_name)"
    }
    append text_version "
#forums.Posted#: $message(posting_date)
-----------------------------------------
$message_text
-----------------------------------------
#forums.To_view_message_follow_link#
$message_url

#forums.To_view_Forum_forum_name_go_to#
$forum_url
"
    # Do the notification for the forum
    notification::new  -type_id [notification::type::get_type_id  -short_name forums_forum_notif]  -object_id $message(forum_id)  -response_id $message(message_id)  -notif_subject "\[$message(forum_name)\] $message(subject)"  -notif_text $text_version  -notif_html $html_version


    # Eventually we need notification for the root message too
    notification::new  -type_id [notification::type::get_type_id  -short_name forums_message_notif]  -object_id $message(root_message_id)  -response_id $message(message_id)  -notif_subject "\[$message(forum_name)\] $message(subject)"  -notif_text $text_version  -notif_html $html_version
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/forums/tcl/messages-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: