I want to create a blog when a user registered and this new blog will be owned by this new user. I extend accountcontroller.cs register method but i can't set blog properties like blog owner and blog path etc. Sure account view doesn't have blog properties
so i want to create a blog dynamically in code. How can I do this?
var blog = _orchardServices.ContentManager.New<BlogPart>("Blog");
dynamic model = _contentManager.UpdateEditor(blog, this);
var role = _roleService.GetRoleByName("Author");
if (role != null)
UserId = context.User.As<IUser>().Id,
Role = role
There's probably no point running UpdateEditor unless you actually have some POST data that can be picked up by blog creation.
Also, how are you extending the register method? The best way is to write an IUserEventHandler and hook into events like Created or ConfirmedEmail.