by Phil 'iwonder' Guerra
(Denver, CO) - Don't know if folks recognized this issue just yet, because it seems to be new with the DNNv5.0.0 release. In the Announcements module, I noticed that my generated newsfeed had changed somewhat. In previous versions, an syndicated news item had the following format: ModuleTitle - AnnouncementTitle. So, if you had setup an Announcements module to syndicate, what you got when you clicked on the syndicate icon was something like this:
Announcements - My Actual Announcement TitleIn fact, I read a recent
post on the Announcements forums where someone asked how to change that format, getting rid of the ModuleTitle. He was told by the project lead that it was not possible. Huh? Now, I don't mean to be disrespectful, because as a former DNN Core Team Memeber, I did not advocate changing DNN Core Code, unless there was a good business reason to do so. Changing Core Code means there's impact when the code is eventually upgraded, your mod will need to be redone at the very least, at worst- your mod will not buy you anything because the method you altered might be obsolete.
However, I knew there was a piece of code that could be tweaked to do it, so I set off on getting rid of this annoyance. Before I started work on it, I loaded up an Announcements module, put in some content, and hit the syndicate icon. Lo and behold, what did I see? Well, instead of the ModuleTitle - AnnouncementTitle being rendered as the Title in the news feed, I was getting just the ModuleTitle for every Announcement in the feed. Oh, man what a terrible implementation. I had to do something.
Anyways, I went about making the small tweak in the Announcements module I was set to do, because, it looked like that was something that still needed to be done. I really don't think folks want the ModuleTitle as part of any syndicated content, at least in the items listed. From what I could see this type of concatenated string was being populated into the SearchItem table, and at least I could change that piece.
Long story short, I made the change, and although, I could see that the SearchItem table reflected the change, the resulting news feed was unaffected. Now that set me off on a long search for the culprit. I was about to give up for the night, I simply could not find anything in the code that could cause this new format to be rendered. I decided to take another approach.
I brought up the database, and looked at the stored procedures, thinking maybe a call to one of those procs was responsible. Still no luck. Then, I thought, maybe there's a View causing this issue. Well, it didn't take long to verify my thinking (there aren't many views setup in the DNN database). I found the following View, vw_SearchItems that contained the following:
SELECT si.SearchItemID, m.PortalID, tm.TabID, m.ModuleID, m.ModuleTitle As Title, si.Description, si.Author, si.PubDate, si.SearchKey, si.Guid, si.HitCount, si.ImageFileId, u.DisplayName AS AuthorName,
FROM dbo.dnn_SearchItem AS si
LEFT OUTER JOIN dbo.dnn_Users AS u ON si.Author = u.UserID INNER JOIN dbo.dnn_Modules AS m ON si.ModuleId = m.ModuleID INNER JOIN dbo.dnn_TabModules AS tm ON m.ModuleID = tm.ModuleIDAs you can see, the offending line, in bold and red, was responsible. Instead of using the information directly from the SearchItem table for the item title element, the module name was being substituted. Well, I changed the view to use the si.title data, and the results were immediate. Now, my announcement's news feed was correctly displaying the Announcement Title as the newsfeed item 'title' element. Something like this example:
My Actual Announcement TitleNow, you'll have to make the change in the code and recompile for every module that you want to show up without the ModuleTitle in the 'title' element, and that's a heavy chore. I'm hoping that the DNN CT will listen to an appeal to change this implementation. In case you want to look for the code for the Announcements, look at the code:
Announcements\Components\AnnouncementsController.vbSearch for the Function GetSearchItems, and in that routine is a line:
SearchItem = New SearchItemInfo(ModInfo.ModuleTitle & " - " & .Title, strDescription, .CreatedByUser, .PublishDate, ModInfo.ModuleID, .ItemId.ToString, strContent, "ItemId=" & .ItemId.ToString) Change it to this line, which gets rid of the concatenation of the ModuleTitle '-' to the .Title:
SearchItem = New SearchItemInfo(.Title, strDescription, .CreatedByUser, .PublishDate, ModInfo.ModuleID, .ItemId.ToString, strContent, "ItemId=" & .ItemId.ToString)Compile the Announcements solution, and replace the existing Announcements.dll with the newly created one. Then, make your change to the SQL database View as described above.
You can do this change yourself, as well if you want, but it does alter the Core code, so unless the CT decides that this is a better approach, your change will get lost when you upgrade.
Also, from what I can tell, any module that assigns a 'title' that isn't the module name will be changed as well, becuase the View change is a global.