Hi,
here is a sample code for creating a user blog:
It's a good place to call this method in membership editor after user registration. You can use Membership editor
AccountCreated event. I believe that you already have some existing users who do not have blog created so you will also need to create a blog for those users.
public
void
CreateBlogForUser(MembershipUser user)
{
BlogEntity blog =
new
BlogEntity(GuidExtension.NewSequentialGuid());
blog.Name = user.UserName;
blog.Slug = UrlSeoOptimizer.GetOptimizedString(blog.Name);
blog.DateCreated = DateTime.Now;
blog.UserId =
new
Guid(user.ProviderUserKey.ToString());
blog.ApplicationId = MembershipRepository.GetInstance().GetApplicationId();
blog.LanguageId = LocalizationUtility.GetCurrentLanguageId();
MonoXCacheManager cacheManager = MonoXCacheManager.GetInstance();
cacheManager.RemoveAll(MonoSoftware.MonoX.Caching.CacheKeys.Blog.Root);
cacheManager.RemoveAll(MonoSoftware.MonoX.Caching.CacheKeys.Blog.Editors);
using
(BlogRepository rep = BlogRepository.GetInstance())
rep.SaveBlog(blog);
}
Regards.