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

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsBlogBlogMonthly archive does not show items posted on last day of month.  FIX INCLUDEDMonthly archive does not show items posted on last day of month. FIX INCLUDED
Previous
 
Next
New Post
9/21/2009 6:39 PM
 

I had a blog entry on April 30, but when I clicked on "April" in my monthly archive, there were no blog entries listed.

After some investigation I found a bug in the stored procedure.

Basically the stored proc is returning all the entries between the first day of the month at 12:00am and last day of the month at 12:00am.  This excludes everything that happens after 12:00am on the last day of the month -- the entire day.

Here's the quick fix I used, which could be easily modified to the DNN SQLDataProvider syntax:

GO

ALTER PROCEDURE Blog_ListEntriesByPortalByMonth
@PortalID int,
@BlogDate datetime = null,
@ShowNonPublic bit = 0,
@ShowNonPublished bit=0,
@MaxEntries int = 10

AS

If @BlogDate IS NULL SET @BlogDate = GetUTCDate()
SET rowcount @MaxEntries
    SELECT
        U.[UserID],
        U.[Username],
        U.[FirstName] + ' ' + U.[LastName] AS UserFullName,
        E.[EntryID],
        E.[BlogID],
        E.[Title],
        E.[Description],
        E.[Entry],
        E.[AddedDate],
        E.[Published],
        E.[Copyright],
        E.[PermaLink],
        IsNull(E.[AllowComments],B.[AllowComments]) As AllowComments,
        B.[ParentBlogID],
        B.[AllowAnonymous],
        B.[Syndicated] AS BlogSyndicated,
        B.[Public] AS BlogPublic,
        B.[SyndicationEmail] as SyndicationEmail,
        (Select Count(*) FROM Blog_Comments WHERE EntryID = E.EntryID AND (Approved = 1 OR Approved <> @ShowNonPublic)) As CommentCount
    FROM Blog_Blogs B INNER JOIN
        Blog_Entries E ON B.[BlogID] = E.[BlogID] INNER JOIN
        Users U ON B.[UserID] = U.[UserID]
    WHERE
    B.PortalID = @PortalID AND
    E.AddedDate BETWEEN DATEADD(month, DATEDIFF(month, 0, @BlogDate), 0)  AND DATEADD(day,1,@BlogDate) AND E.AddedDate <=  GetUTCDate()
AND (E.[Published] = 1 OR E.[Published] <> @ShowNonPublished)
    AND (B.[Public] = 1 OR B.[Public] <> @ShowNonPublic)
    ORDER BY E.AddedDate DESC
   
GO

 
New Post
9/23/2009 10:46 AM
 
update 

 Looks like I modified the incorrect stored procedure.

Here are the two that make the difference:

GO

/****** Object:  StoredProcedure [dbo].[Blog_ListEntriesByPortal]    Script Date: 09/22/2009 09:03:21 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO



ALTER PROCEDURE [dbo].[Blog_ListEntriesByPortal]

@PortalID int,

@BlogDate datetime = null,

@ShowNonPublic bit = 0,

@ShowNonPublished bit=0,

@MaxEntries int = 10


AS


If @BlogDate IS NULL SET @BlogDate = GetUTCDate()

SET rowcount @MaxEntries

 SELECT

 U.[UserID],

 U.[Username],

 U.[FirstName] + ' ' + U.[LastName] AS UserFullName,

 E.[EntryID],

 E.[BlogID], 

 E.[Title],

 E.[Description],

 E.[Entry],

 E.[AddedDate],

 E.[Published],

 E.[Copyright],

 E.[PermaLink],

 IsNull(E.[AllowComments],B.[AllowComments]) As AllowComments,

 B.[ParentBlogID],

 B.[AllowAnonymous],

 B.[Syndicated] AS BlogSyndicated,

 B.[Public] AS BlogPublic,

 B.[SyndicationEmail] as SyndicationEmail,

 (Select Count(*) FROM dbo.Blog_Comments WHERE EntryID = E.EntryID AND (Approved = 1 OR Approved <> @ShowNonPublic)) As CommentCount

 FROM   dbo.Blog_Blogs B INNER JOIN

 dbo.Blog_Entries E ON B.[BlogID] = E.[BlogID] INNER JOIN

 dbo.Users U ON B.[UserID] = U.[UserID]

 WHERE B.PortalID = @PortalID AND E.AddedDate <= DATEADD(day,1,@BlogDate)

 AND (E.[Published] = 1 OR E.[Published] <> @ShowNonPublished)

 AND (B.[Public] = 1 OR B.[Public] <> @ShowNonPublic)

 ORDER BY E.AddedDate DESC

GO
/****** Object:  StoredProcedure [dbo].[Blog_ListEntriesByBlog]    Script Date: 09/22/2009 09:04:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


ALTER PROCEDURE [dbo].[Blog_ListEntriesByBlog]
	@BlogID int,
	@BlogDate datetime = null,
	@ShowNonPublic bit = 0,
	@ShowNonPublished bit=0,
	@MaxEntries int =10

AS

If @BlogDate IS NULL SET @BlogDate = GetUTCDate()

	SET rowcount @MaxEntries
	SELECT
		U.[UserID],
		U.[Username],
		U.[FirstName] + ' ' + U.[LastName] AS UserFullName,
		E.[EntryID],
		E.[BlogID], 
		E.[Title],
		E.[Description],
		E.[Entry],
		E.[AddedDate],
		E.[Published],
		E.[Copyright],
		E.[PermaLink],
		IsNull(E.[AllowComments],B.[AllowComments]) As AllowComments,
		(Select Count(*) FROM dbo.Blog_Comments WHERE EntryID = E.EntryID AND (Approved = 1 OR Approved <> @ShowNonPublic)) As CommentCount,

		B.[PortalID] As BlogPortalID,
		B.[ParentBlogID],
		B.[Title] As BlogTitle,
		B.[Description] As BlogDescription,
		B.[Public] As BlogPublic,
		B.[AllowComments] As BlogAllowComments,
		B.[AllowAnonymous] As BlogAllowAnonymous,
		B.[LastEntry] As BlogLastEntry,
		B.[Created] As BlogCreated,
		B.[Culture] As BlogCulture,
		B.[ShowFullname] As BlogShowFullName,
		B.[Dateformat] As BlogDateformat,
		B.[TimeZone] As BlogTimeZone,
		B.[Syndicated] As BlogSyndicated,
		B.[SyndicateIndependant] As BlogSyndicateIndependant,
		B.[SyndicationEmail] As SyndicationEmail


	FROM   dbo.Blog_Blogs B INNER JOIN
		dbo.Blog_Entries E ON B.[BlogID] = E.[BlogID] INNER JOIN
		dbo.Users U ON B.[UserID] = U.[UserID]
	WHERE (B.[BlogID] = @BlogID OR B.[ParentBlogID] = @BlogID)
	AND E.AddedDate <= DATEADD(day,1,@BlogDate)
	AND (E.[Published] = 1 OR E.[Published] <> @ShowNonPublished)
	AND (B.[Public] = 1 OR B.[Public] <> @ShowNonPublic)
	ORDER BY E.AddedDate DESC

	
 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsBlogBlogMonthly archive does not show items posted on last day of month.  FIX INCLUDEDMonthly archive does not show items posted on last day of month. FIX INCLUDED


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