I've created a blog section, which saves questions, comments, and replies. One each of these creations, I am trying to save the newly publishing content w/ the member that is creating each one. I've attempted to use this solution here:
, but this did not work, as I receive this exception:
Message":"An error has occurred.","ExceptionMessage":"Object reference not set to an instance of an object.","ExceptionType":"System.NullReferenceException","StackTrace":" at Umbraco.Core.Services.UserService.GetProfileById(Int32 id) line 511\r\n ..........
Can we not save newly created content as a MEMBER (not user)?
var cs = new ContentService();
IPublishedContent node = Umbraco.TypedContent(model.Id);
if (node != null)
{
IContent newPost = cs.CreateContent(postName, node.Id, model.PostType);
newPost.SetValue("comment", model.Comment);
// Id is 2195 and has all of the member data in there
cs.SaveAndPublishWithStatus(newPost, Members.GetCurrentMember().Id);
}
We're using Umbraco version 7.2.0 assembly: 1.0.5500.16261
When you publish a page this needs to done by a User and not a Member. Users have access to the Umbraco backoffice and members don't so they can't publish anything.
Publish New Content w/ Member (Not User) Id Error
I've created a blog section, which saves questions, comments, and replies. One each of these creations, I am trying to save the newly publishing content w/ the member that is creating each one. I've attempted to use this solution here:
http://our.umbraco.org/forum/umbraco-7/using-umbraco-7/57287-How-to-set-the-creator-or-writer-of-a-content-item-in-a-controller-action
, but this did not work, as I receive this exception:
Can we not save newly created content as a MEMBER (not user)?
We're using Umbraco version 7.2.0 assembly: 1.0.5500.16261
Yes no maybe so?
Hello,
When you publish a page this needs to done by a User and not a Member. Users have access to the Umbraco backoffice and members don't so they can't publish anything.
Jeroen
Ok was figuring that since I was receiving error on "UserProfile". Appreciate it.
is working on a reply...