How to show only author posts in blogpost widget - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

How to show only author posts in blogpost widget

  • How to show only author posts in blogpost widget
  • Hi,

    I need to show only currently logged user posts in blogpost widget, how can i filter them?

    I got:

    public bool UserIdComp(Telerik.Sitefinity.Blogs.Model.BlogPost post)
       
                var identity = ClaimsManager.GetCurrentIdentity();
                Guid currentUserGuid = identity.UserId;
                Guid postOwnerId = new Guid(Telerik.Sitefinity.Model.DataExtensions.GetValue(post, "Owner").ToString());
                
                Telerik.Sitefinity.Security.UserManager userManager = Telerik.Sitefinity.Security.UserManager.GetManager();
                if(currentUserGuid.Equals(postOwnerId))
                return true;
                else
                return false;
       

    It works, but i cant use "if" in RadListView ItemTemplate to check if that post belong to currently logged user cause i want to show only such posts.

    I wanna do sth like this:

    <telerik:RadListView ID="Repeater">

    <LayoutTemplate>

    some data

    </LayoutTemplate>

    <ItemTemplate>

    if(UserIdComp((Telerik.Sitefinity.Blogs.Model.BlogPost)Container.DataItem))

    show post

    </ItemTemplate>

    </telerik:RadListView>

    Thanks in advance

  • Setting permissions on blog posts should do the trick. I believe you can set view permissions to owner. 
  • But i need to show owner posts only on this page, on other i wanna show all blogposts. If i set permissions on blogposts to owner it will be applied on all pages i think.