Incoming RSS to Blog - Set Owner?
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?
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();