Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > How to display list of distinct Blog Authors name and their Blog posts list? View modes: 
User avatar
Member
Member
rahul.raghuvanshi85-gmail - 1/13/2014 4:21:32 AM
   
How to display list of distinct Blog Authors name and their Blog posts list?
I have integrated blog module in my site. I need to display List of all Blog post authors name using repeater, I used following code in my repeater transformation:
"<%# BlogFunctions.GetUserFullName(Eval("NodeOwner")) %>"

But its giving me duplicate records.
I need help to implement followings:

1> How can I configure my repeater web part to get distinct "NodeOwnerName" or get all users of specific site?
2> On click of any Blog author name those getting in repeater, I want to show list of Blog posts of selected author into Repeater web part?
3> In transformation how can I get "Category name" of each document?

I am new in Kentico, If possible please provide code.

Thanks in Advance.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 1/14/2014 7:10:18 AM
   
RE:How to display list of distinct Blog Authors name and their Blog posts list?
Create a custom query on the CMS_User system table by going to CMSSiteManager>Development>System Tables>User>Queries.
SELECT DISTINCT UserID, FullName, UserName
FROM View_CONTENT_BlogPost_Joined
LEFT OUTER JOIN CMS_User ON DocumentCreatedByUserID = UserID
Then add a Repeater with custom query webpart to your page. Select the newly created query. Set the other properties as you wish and create a transformation. Your transformation might be as simple as
<div><a href="/Your/Page/<%# Eval("UserName") %>"><%# Eval("FullName") %></a></div>
Then create another page, add a repeater webpart to it. This one will be configured to display a list of blog posts for that user. The repeater will display CMS.BlogPost and have a where clause something like this
{%"DocumentCreatedByUserID = (SELECT UserID FROM CMS_User WHERE UserName = '" + {?UserName?} + "')"|(handlesqlinjection)false@%}
On your page you just added this repeater to, you will want to go to the Properties>URLs tab and add an alias
/Your/Page/{UserName}
This should get you what you need or very close.