Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing DotNetNuke.Services.MessagingUsing DotNetNuke.Services.Messaging
Previous
 
Next
New Post
3/30/2015 10:23 AM
 

I have a question, related to DotNetNuke Messaging. I'm developing a module which sends a message to others user, but there are some way to send a link inside the body message?

The problem is that the link is encoded as string and not as html tag.

 
New Post
4/4/2015 9:24 AM
 
no, there isn't a way via the API - this is intentional as we only wanted to support plain text and not html (due to historical issues with cross-site scripting/html injection)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
4/5/2015 3:58 AM
 

I have a mobile app that uses DNN which sends messages/journal posts on certain actions. Here is the code I use - 

When I add a new game on the mobile app it posts the link to the Journal and sends a Notification to the game creator. This will have a link in it. It will also send an email to the user containing a link (using the PM Template)

 

 private void ProcessNewGame(bool isEditGame, Game game)

        {

            string gameUrl = String.Format("http://www.pokerdiy.com/poker-game/home-poker/view/poker-game/{0}.aspx", game.GameId);

            //From game Author

            UserInfo gameHostUserInfo = UserController.GetUserById(PortalSettings.Current.PortalId, game.HostUserId);

            //notifiy game host

            string notificationGameSubject = String.Format(Localization.GetString("NewGameHostNotificationSubject", localResourceFile), game.Title);

            StringBuilder notificationGameBody = new StringBuilder(String.Format(Localization.GetString("NewGameHostNotificationBody", localResourceFile), game.Summary, gameUrl));

            Notifications.CreateJournalMentionNotification(notificationGameSubject, notificationGameBody.ToString(), gameHostUserInfo, new List { gameHostUserInfo });

            if (!isEditGame)

            {

                //only do this for new games

                Journal.CreateGameJournalPost(game, gameHostUserInfo, null, String.Format(Localization.GetString("NewGameJournalBody.Text", localResourceFile), gameUrl, game.City, game.Title, game.Summary), gameUrl);

            }

        }


 

    public class Notifications

    {

        internal static void CreateJournalMentionNotification(string notificationSubject, string body, UserInfo fromUser, List<UserInfo> toUserList)

        {

            var notification = new Notification();

            notification.NotificationTypeID = 15; //JournalMention

            notification.Subject = notificationSubject;

            notification.Body = body;

            notification.IncludeDismissAction = true;

            notification.SenderUserID = fromUser.UserID;  //this is the person who it is listed as from

            notification.Context = "";

            NotificationsController.Instance.SendNotification(notification, Constants.PortalId, null, toUserList);

        }

    }

 

 

 

   internal static void CreateGameJournalPost(Game game, UserInfo hostUser, string subject, string body, string gameUrl)

        {

            //http://www.dnnsoftware.com/wiki/page/journal

            //https://github.com/DNN-Connect/kickstart/blob/master/Components/Integration/JournalController.vb

            //https://github.com/DNN-Connect/DNN-Blog/blob/master/Components/Integration/JournalController.vb

            //SELECT TOP 50 * FROM Journal ORDER BY JournalId Desc

            var journalItem = new JournalItem();

            journalItem.PortalId = Constants.PortalId;

            journalItem.UserId = hostUser.UserID;

            journalItem.ProfileId = hostUser.UserID;

 

            journalItem.Title = subject;

            journalItem.Summary = body;

            journalItem.Body = null;

 

            journalItem.ContentItemId = game.GameId;

            journalItem.ItemData = new ItemData { Url = gameUrl };

            journalItem.JournalTypeId = 1; //Status Update = 1 and new game ad, 18 is game comment

            journalItem.ObjectKey = String.Format("Ventrian_Article_{0}:{1}", game.GameId, "-1");

            journalItem.SecuritySet = "E";

            JournalController.Instance.SaveJournalItem(journalItem, 1);

        }


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
4/5/2015 5:45 PM
 
thanks for the post Rodney - just to clarify, that's notifications (which support html as they have links), and not messages as the user asked (messages are encoded on display)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
5/8/2015 2:55 AM
 
A way I found is on the CoreMessaging/View.ascx template is use data-bind="html: Body" instead of data-bind="text: Body"
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing DotNetNuke.Services.MessagingUsing DotNetNuke.Services.Messaging


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out