More in this section

Forums / General Discussions / Incoming RSS to Blog - Set Owner?

Incoming RSS to Blog - Set Owner?

2 posts, 0 answered
  1. Mark
    Mark avatar
    147 posts
    Registered:
    01 Jun 2010
    20 Jan 2012
    Link to this post
    I have an incoming RSS feed that publishes to my Sitefinity blog. When my content people review the draft and post it the owner comes back as 'User Not Found'. Is there a way to set the owner?
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    21 Jan 2012
    Link to this post
    Hi Mark,

    By default the Owner of the blog post should be set to the Owner of the Blog they are created under. If the user who created that particular blog does not exist anymore it is normal for Sitefinity to display 'User Not Found'. One option would be to recreate the blog with an existing user, or try to change the owner programatically like this:
    protected void Page_Load(object sender, EventArgs e)
            {
                var manager = UserManager.GetManager();
                var newOwner = manager.GetUser("MyUser").Id;
                ChangeBlogAndPostsOwner("MyBlog", newOwner);
            }
     
            public void ChangeBlogAndPostsOwner( string blogTitle, Guid ownerId)
            {
                var myBlog = App.WorkWith().Blogs().Where(b => b.Title == blogTitle).ForEach(b =>
                    {
                        b.Owner = ownerId;
                    }).SaveAndContinue().Get().SingleOrDefault();
                App.WorkWith().BlogPosts().Where(bp => bp.Parent == myBlog.Id).ForEach(bp =>
                    {
                        bp.Owner = ownerId;
                    }).SaveChanges();
            }


    Kind regards,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered